Module xl.core

Class XClass<T>

java.lang.Object
de.grogra.reflect.XObjectImpl
de.grogra.reflect.XClass<T>
All Implemented Interfaces:
Member, Type<T>, XObject
Direct Known Subclasses:
CClass

public class XClass<T> extends XObjectImpl implements Type<T>
  • Constructor Details

    • XClass

      public XClass(String simpleName, String binaryName, int modifiers, Type<?> declaringClass, boolean writable)
  • Method Details

    • initSupertype

      public void initSupertype(Type<? super T> superclass)
    • initTypeLoader

      public void initTypeLoader(TypeLoader loader)
    • initialize

      public void initialize()
    • declareSyntheticField

      public XField declareSyntheticField(String baseName, int modifiers, Type<?> type)
    • declareAuxField

      public XField declareAuxField(String name, int modifiers, Type<?> type)
    • declareField

      public XField declareField(String name, int modifiers, Type<?> type)
    • removeField

      public void removeField(Field field)
    • makeVisible

      public void makeVisible(XField field)
    • declareMethod

      public void declareMethod(Method method)
    • removeMethod

      public void removeMethod(Method method)
    • declareType

      public void declareType(XClass<?> type)
    • addInterface

      public void addInterface(Type<?> type)
    • getDeclaredAnnotations

      public List<Annotation> getDeclaredAnnotations()
    • newInstance

      Specified by:
      newInstance in interface Type<T>
      Throws:
      InvocationTargetException
      InstantiationException
      IllegalAccessException
    • getTypeId

      public int getTypeId()
      Description copied from interface: Type
      Returns the type id of this type.
      Specified by:
      getTypeId in interface Type<T>
      Returns:
      this type's type id
      See Also:
    • getPackage

      public String getPackage()
      Specified by:
      getPackage in interface Type<T>
    • getModifiers

      public int getModifiers()
      Description copied from interface: Member
      Returns the modifiers of this member as a combination of the bit masks which are defined in this interface.
      Specified by:
      getModifiers in interface Member
      Returns:
      modifiers of this member
    • setPublic

      public void setPublic()
    • getDeclaringType

      public Type<?> getDeclaringType()
      Description copied from interface: Member
      Returns the declaring type of which this is a member. May be null if such a type does not exist.
      Specified by:
      getDeclaringType in interface Member
      Returns:
      this member's declaring type
    • hasSupertypeBeenSet

      public boolean hasSupertypeBeenSet()
    • getSupertype

      public Type<? super T> getSupertype()
      Specified by:
      getSupertype in interface Type<T>
    • getName

      public String getName()
      Description copied from interface: Member
      Returns the name of this member. For types, this is the canonical name of the type, e.g, java.lang.Object, java.util.Map.Entry. Otherwise, it equals Member.getSimpleName().
      Specified by:
      getName in interface Member
      Returns:
      name of the member
    • getBinaryName

      public String getBinaryName()
      Specified by:
      getBinaryName in interface Type<T>
    • getDescriptor

      public String getDescriptor()
      Description copied from interface: Member
      Returns a descriptor for this member. Descriptors are constructed as follows:
      • For types, descriptors are defined as for the Java Virtual Machine. For primitive types these are the single characters 'Z', 'B', 'S', 'C', 'I', 'J', 'F', 'D', 'V' for boolean, byte, short, char, int, long, float, double, void. For array types, the descriptor is the character '[' plus the descriptor of its component type, e.g., [[I for int[][]. For non-array reference types, the descriptor is the character 'L', followed by the binary name (see Type.getBinaryName()) of the type, where '.' has to be replaced by '/', followed by ';', e.g., Ljava/lang/Object;.
      • For fields, the descriptor is the character 'f', followed by the simple name of the field, followed by the character ';', followed by the descriptor of the field's type. E.g., fout;Ljava/io/PrintStream; for the field System.out.
      • For methods and constructors, the descriptor is the character 'm', followed by the simple name of the method (which is <init> for constructors), followed by the characters ';' and '(', followed by the descriptors of the method's parameter types, followed by ')', followed by the descriptor of the return type. E.g. mprintln;(Ljava/lang/String;)V for the method PrintStream.println(String).
      Specified by:
      getDescriptor in interface Member
      Returns:
      the member's descriptor
    • isInstance

      public boolean isInstance(Object object)
      Specified by:
      isInstance in interface Type<T>
    • getImplementationClass

      public Class<T> getImplementationClass()
      Specified by:
      getImplementationClass in interface Type<T>
    • getTypeLoader

      public TypeLoader getTypeLoader()
      Specified by:
      getTypeLoader in interface Type<T>
    • getDeclaredInterfaceCount

      public int getDeclaredInterfaceCount()
      Specified by:
      getDeclaredInterfaceCount in interface Type<T>
    • getDeclaredInterface

      public Type<?> getDeclaredInterface(int index)
      Specified by:
      getDeclaredInterface in interface Type<T>
    • getDeclaredTypeCount

      public int getDeclaredTypeCount()
      Specified by:
      getDeclaredTypeCount in interface Type<T>
    • getDeclaredType

      public Type<?> getDeclaredType(int index)
      Specified by:
      getDeclaredType in interface Type<T>
    • getDeclaredFieldCount

      public int getDeclaredFieldCount()
      Specified by:
      getDeclaredFieldCount in interface Type<T>
    • getDeclaredField

      public Field getDeclaredField(int index)
      Specified by:
      getDeclaredField in interface Type<T>
    • getDeclaredField

      public XField getDeclaredField(String name)
    • getDeclaredMethodCount

      public int getDeclaredMethodCount()
      Specified by:
      getDeclaredMethodCount in interface Type<T>
    • getDeclaredMethod

      public Method getDeclaredMethod(int index)
      Specified by:
      getDeclaredMethod in interface Type<T>
    • getDeclaredAnnotationCount

      public int getDeclaredAnnotationCount()
      Specified by:
      getDeclaredAnnotationCount in interface Member
    • getDeclaredAnnotation

      public Annotation getDeclaredAnnotation(int index)
      Specified by:
      getDeclaredAnnotation in interface Member
    • getSimpleName

      public String getSimpleName()
      Description copied from interface: Member
      Returns the simple name of this member. This is the single identifier with which the member is declared in source code, e.g., Object, out, println.
      Specified by:
      getSimpleName in interface Member
      Returns:
      simple name of the member
    • getComponentType

      public Type<?> getComponentType()
      Specified by:
      getComponentType in interface Type<T>
    • getArrayType

      public Type<?> getArrayType()
      Specified by:
      getArrayType in interface Type<T>
    • createArray

      public Object createArray(int length)
      Specified by:
      createArray in interface Type<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isStringSerializable

      public boolean isStringSerializable()
      Specified by:
      isStringSerializable in interface Type<T>
    • valueOf

      public T valueOf(String s)
      Specified by:
      valueOf in interface Type<T>
    • cloneObject

      public T cloneObject(T o, boolean deep)
      Specified by:
      cloneObject in interface Type<T>
    • getLookup

      public final Lookup getLookup()
      Specified by:
      getLookup in interface Type<T>
    • updateLookup

      protected final void updateLookup()
    • getDefaultElementValue

      public Object getDefaultElementValue(String name)
      Specified by:
      getDefaultElementValue in interface Type<T>