Class XJCJavaClassImpl

java.lang.Object
org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaClassImpl
All Implemented Interfaces:
JavaClass, JavaHasAnnotations

public class XJCJavaClassImpl extends Object implements JavaClass
INTERNAL:

Purpose: JavaClass implementation wrapping XJC's JDefinedClass. Used when bootstrapping a DynamicJAXBContext from an XML Schema.

Responsibilities:

  • Provide Class information from the underlying JDefinedClass.
See Also:
  • Constructor Details

    • XJCJavaClassImpl

      public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader)
      Construct a new instance of XJCJavaClassImpl.
      Parameters:
      jDefinedClass - - the XJC JDefinedClass to be wrapped.
      codeModel - - the XJC JCodeModel this class belongs to.
      loader - - the ClassLoader used to bootstrap the DynamicJAXBContext.
    • XJCJavaClassImpl

      public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader, boolean isArray, boolean isPrimitive)
      Construct a new instance of XJCJavaClassImpl.
      Parameters:
      jDefinedClass - - the XJC JDefinedClass to be wrapped.
      codeModel - - the XJC JCodeModel this class belongs to.
      loader - - the ClassLoader used to bootstrap the DynamicJAXBContext.
      isArray - - indicates that this class is an array type.
      isPrimitive - - indicates that this class is a primitive type.
  • Method Details

    • setActualTypeArgument

      public void setActualTypeArgument(JavaClass javaClass)
    • getActualTypeArguments

      public Collection<JavaClass> getActualTypeArguments()
      Return the "actual" type from a parameterized type. For example, if this JavaClass represents List<Employee, this method will return the Employee JavaClass.
      Specified by:
      getActualTypeArguments in interface JavaClass
      Returns:
      a Collection containing the actual type's JavaClass.
    • getComponentType

      public JavaClass getComponentType()
      If this JavaClass is an array type, return the type of the array components.
      Specified by:
      getComponentType in interface JavaClass
      Returns:
      JavaClass of this array's component type, or null if this is not an array type.
    • getConstructor

      public JavaConstructor getConstructor(JavaClass[] parameterTypes)
      Return the JavaConstructor for this JavaClass that has the provided parameter types.
      Specified by:
      getConstructor in interface JavaClass
      Parameters:
      parameterTypes - the parameter list used to identify the constructor.
      Returns:
      the JavaConstructor with the signature matching parameterTypes.
    • getConstructors

      public Collection<JavaConstructor> getConstructors()
      Return all of the JavaConstructors for this JavaClass.
      Specified by:
      getConstructors in interface JavaClass
      Returns:
      A Collection containing this JavaClass' JavaConstructors.
    • getDeclaredClasses

      public Collection<JavaClass> getDeclaredClasses()
      Return this JavaClass' inner classes.
      Specified by:
      getDeclaredClasses in interface JavaClass
      Returns:
      A Collection<JavaClass> containing this JavaClass' inner classes.
    • getDeclaredConstructor

      public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes)
      Return the declared JavaConstructor for this JavaClass that has the provided parameter types.
      Specified by:
      getDeclaredConstructor in interface JavaClass
      Parameters:
      parameterTypes - the parameter list used to identify the constructor.
      Returns:
      the JavaConstructor with the signature matching parameterTypes.
    • getDeclaredConstructors

      public Collection<JavaConstructor> getDeclaredConstructors()
      Return all of the declared JavaConstructors for this JavaClass.
      Specified by:
      getDeclaredConstructors in interface JavaClass
      Returns:
      A Collection containing this JavaClass' JavaConstructors.
    • getDeclaredField

      public JavaField getDeclaredField(String fieldName)
      Return the declared JavaField for this JavaClass, identified by fieldName.
      Specified by:
      getDeclaredField in interface JavaClass
      Parameters:
      fieldName - the name of the JavaField to return.
      Returns:
      the JavaField named fieldName from this JavaClass.
    • getDeclaredFields

      public Collection<JavaField> getDeclaredFields()
      Return all of the declared JavaFields for this JavaClass.
      Specified by:
      getDeclaredFields in interface JavaClass
      Returns:
      A Collection containing this JavaClass' JavaFields.
    • getDeclaredMethod

      public JavaMethod getDeclaredMethod(String name, JavaClass[] args)
      Return the declared JavaMethod for this JavaClass, identified by name, with the signature matching args.
      Specified by:
      getDeclaredMethod in interface JavaClass
      Parameters:
      name - the name of the JavaMethod to return.
      args - the parameter list used to identify the method.
      Returns:
      the matching JavaMethod from this JavaClass.
    • getDeclaredMethods

      public Collection<JavaMethod> getDeclaredMethods()
      Return all of the declared JavaMethods for this JavaClass.
      Specified by:
      getDeclaredMethods in interface JavaClass
      Returns:
      A Collection containing this JavaClass' JavaMethods.
    • getMethod

      public JavaMethod getMethod(String name, JavaClass[] args)
      Return the JavaMethod for this JavaClass, identified by name, with the signature matching args.
      Specified by:
      getMethod in interface JavaClass
      Parameters:
      name - the name of the JavaMethod to return.
      args - the parameter list used to identify the method.
      Returns:
      the matching JavaMethod from this JavaClass.
    • getMethods

      public Collection<JavaMethod> getMethods()
      Return all of the JavaMethods for this JavaClass.
      Specified by:
      getMethods in interface JavaClass
      Returns:
      A Collection containing this JavaClass' JavaMethods.
    • getModifiers

      public int getModifiers()
      Returns the Java language modifiers for this JavaClass, encoded in an integer.
      Specified by:
      getModifiers in interface JavaClass
      Returns:
      the int representing the modifiers for this class.
      See Also:
    • getName

      public String getName()
      Returns the name of this JavaClass.
      Specified by:
      getName in interface JavaClass
      Returns:
      the String name of this JavaClass.
    • getPackage

      public JavaPackage getPackage()
      Returns the JavaPackage that this JavaClass belongs to.
      Specified by:
      getPackage in interface JavaClass
      Returns:
      the JavaPackage of this JavaClass.
    • getPackageName

      public String getPackageName()
      Returns the package name of this JavaClass.
      Specified by:
      getPackageName in interface JavaClass
      Returns:
      the String name of this JavaClass' JavaPackage.
    • getQualifiedName

      public String getQualifiedName()
      Returns the fully-qualified name of this JavaClass.
      Specified by:
      getQualifiedName in interface JavaClass
      Returns:
      the String name of this JavaClass.
    • getRawName

      public String getRawName()
      Returns the raw name of this JavaClass. Array types will have "[]" appended to the name.
      Specified by:
      getRawName in interface JavaClass
      Returns:
      the String raw name of this JavaClass.
    • getSuperclass

      public JavaClass getSuperclass()
      Returns the super class of this JavaClass.
      Specified by:
      getSuperclass in interface JavaClass
      Returns:
      JavaClass representing the super class of this JavaClass.
    • getGenericInterfaces

      public Type[] getGenericInterfaces()
      Specified by:
      getGenericInterfaces in interface JavaClass
    • getGenericSuperclass

      public Type getGenericSuperclass()
      Specified by:
      getGenericSuperclass in interface JavaClass
    • hasActualTypeArguments

      public boolean hasActualTypeArguments()
      Indicates if this JavaClass has actual type arguments, i.e. is a parameterized type (for example, List<Employee).
      Specified by:
      hasActualTypeArguments in interface JavaClass
      Returns:
      true if this JavaClass is parameterized, otherwise false.
    • isAbstract

      public boolean isAbstract()
      Indicates if this JavaClass is abstract.
      Specified by:
      isAbstract in interface JavaClass
      Returns:
      true if this JavaClass is abstract, otherwise false.
    • isAnnotation

      public boolean isAnnotation()
      Indicates if this JavaClass is an Annotation.
      Specified by:
      isAnnotation in interface JavaClass
      Returns:
      true if this JavaClass is an Annotation, otherwise false.
    • isArray

      public boolean isArray()
      Indicates if this JavaClass is an Array type.
      Specified by:
      isArray in interface JavaClass
      Returns:
      true if this JavaClass is an Array type, otherwise false.
    • isAssignableFrom

      public boolean isAssignableFrom(JavaClass javaClass)
      Indicates if this JavaClass is either the same as, or is a superclass of, the javaClass argument.
      Specified by:
      isAssignableFrom in interface JavaClass
      Parameters:
      javaClass - the Class to test.
      Returns:
      true if this JavaClass is assignable from javaClass, otherwise false.
      See Also:
    • isEnum

      public boolean isEnum()
      Indicates if this JavaClass is an enum.
      Specified by:
      isEnum in interface JavaClass
      Returns:
      true if this JavaClass is an enum, otherwise false.
    • isFinal

      public boolean isFinal()
      Indicates if this JavaClass is final.
      Specified by:
      isFinal in interface JavaClass
      Returns:
      true if this JavaClass is final, otherwise false.
    • isInterface

      public boolean isInterface()
      Indicates if this JavaClass is an interface.
      Specified by:
      isInterface in interface JavaClass
      Returns:
      true if this JavaClass is an interface, otherwise false.
    • isMemberClass

      public boolean isMemberClass()
      Indicates if this JavaClass is an inner Class.
      Specified by:
      isMemberClass in interface JavaClass
      Returns:
      true if this JavaClass is an inner Class, otherwise false.
    • isPrimitive

      public boolean isPrimitive()
      Indicates if this JavaClass represents a primitive type.
      Specified by:
      isPrimitive in interface JavaClass
      Returns:
      true if this JavaClass represents a primitive type, otherwise false.
    • isPrivate

      public boolean isPrivate()
      Indicates if this JavaClass is private.
      Specified by:
      isPrivate in interface JavaClass
      Returns:
      true if this JavaClass is private, otherwise false.
    • isProtected

      public boolean isProtected()
      Indicates if this JavaClass is protected.
      Specified by:
      isProtected in interface JavaClass
      Returns:
      true if this JavaClass is protected, otherwise false.
    • isPublic

      public boolean isPublic()
      Indicates if this JavaClass is public.
      Specified by:
      isPublic in interface JavaClass
      Returns:
      true if this JavaClass is public, otherwise false.
    • isStatic

      public boolean isStatic()
      Indicates if this JavaClass is static.
      Specified by:
      isStatic in interface JavaClass
      Returns:
      true if this JavaClass is static, otherwise false.
    • isSynthetic

      public boolean isSynthetic()
      Not supported.
      Specified by:
      isSynthetic in interface JavaClass
    • instanceOf

      public JavaClassInstanceOf instanceOf()
      Specified by:
      instanceOf in interface JavaClass
    • getAnnotation

      public JavaAnnotation getAnnotation(JavaClass aClass)
      If this JavaClass is annotated with an Annotation matching aClass, return its JavaAnnotation representation.
      Specified by:
      getAnnotation in interface JavaHasAnnotations
      Parameters:
      aClass - a JavaClass representing the Annotation to look for.
      Returns:
      the JavaAnnotation represented by aClass, if one exists, otherwise return null.
    • getAnnotations

      public Collection<JavaAnnotation> getAnnotations()
      Return all of the Annotations for this JavaClass.
      Specified by:
      getAnnotations in interface JavaHasAnnotations
      Returns:
      A Collection containing this JavaClass' JavaAnnotations.
    • getDeclaredAnnotation

      public JavaAnnotation getDeclaredAnnotation(JavaClass arg0)
      Not supported.
      Specified by:
      getDeclaredAnnotation in interface JavaHasAnnotations
    • getDeclaredAnnotations

      public Collection<JavaAnnotation> getDeclaredAnnotations()
      Not supported.
      Specified by:
      getDeclaredAnnotations in interface JavaHasAnnotations
    • getJavaModel

      public JavaModel getJavaModel()
      Get this JavaClass' JavaModel.
      Returns:
      The JavaModel associated with this JavaClass.
    • setJavaModel

      public void setJavaModel(JavaModel javaModel)
      Set this JavaClass' JavaModel.
      Parameters:
      javaModel - The JavaModel to set.