Class OXMJavaClassImpl

  • All Implemented Interfaces:
    JavaClass, JavaHasAnnotations

    public class OXMJavaClassImpl
    extends java.lang.Object
    implements JavaClass
    INTERNAL:

    Purpose: JavaClass implementation wrapping MOXy's xmlmodel.JavaType. Used when bootstrapping a DynamicJAXBContext from XML Bindings.

    Responsibilities:

    • Provide Class information from the underlying JavaType.
    See Also:
    JavaClass, JavaType
    Since:
    EclipseLink 2.2
    • Constructor Detail

      • OXMJavaClassImpl

        public OXMJavaClassImpl​(JavaType aJavaType)
        Construct a new instance of OXMJavaClassImpl.
        Parameters:
        aJavaType - - the XJC JavaType to be wrapped.
      • OXMJavaClassImpl

        public OXMJavaClassImpl​(java.lang.String aJavaTypeName)
        Construct a new instance of OXMJavaClassImpl.
        Parameters:
        aJavaTypeName - - the name of the JavaType to create.
      • OXMJavaClassImpl

        public OXMJavaClassImpl​(java.lang.String aJavaTypeName,
                                java.util.List<java.lang.String> enumValues)
        Construct a new instance of OXMJavaClassImpl representing a Java enum.
        Parameters:
        aJavaTypeName - - the name of the JavaType to create.
        enumValues - - the list of values for this enum.
    • Method Detail

      • getActualTypeArguments

        public java.util.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:
        always returns null, as JavaTypes do not represent arrays.
      • 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 java.util.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 java.util.Collection<JavaClass> getDeclaredClasses()
        Return this JavaClass' inner classes.
        Specified by:
        getDeclaredClasses in interface JavaClass
        Returns:
        always returns an empty ArrayList as JavaTypes do not represent inner classes.
      • getDeclaredConstructors

        public java.util.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​(java.lang.String name)
        Return the declared JavaField for this JavaClass, identified by fieldName.
        Specified by:
        getDeclaredField in interface JavaClass
        Parameters:
        name - the name of the JavaField to return.
        Returns:
        the JavaField named fieldName from this JavaClass.
      • getDeclaredFields

        public java.util.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​(java.lang.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:
        always returns null, as JavaTypes do not have methods.
      • getDeclaredMethods

        public java.util.Collection<JavaMethod> getDeclaredMethods()
        Return all of the declared JavaMethods for this JavaClass.
        Specified by:
        getDeclaredMethods in interface JavaClass
        Returns:
        always returns an empty ArrayList, as JavaTypes do not have methods.
      • getMethod

        public JavaMethod getMethod​(java.lang.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:
        always returns null, as JavaTypes do not have methods.
      • getMethods

        public java.util.Collection<JavaMethod> getMethods()
        Return all of the JavaMethods for this JavaClass.
        Specified by:
        getMethods in interface JavaClass
        Returns:
        always returns an empty ArrayList, as JavaTypes do not have methods.
      • getModifiers

        public int getModifiers()
        Returns the Java language modifiers for this JavaClass, encoded in an integer.
        Specified by:
        getModifiers in interface JavaClass
        Returns:
        always returns 0 as JavaTypes do not have modifiers.
        See Also:
        Modifier
      • getName

        public java.lang.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 java.lang.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 java.lang.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 java.lang.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.
      • 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:
        always returns false as JavaTypes are not parameterized.
      • isAbstract

        public boolean isAbstract()
        Indicates if this JavaClass is abstract.
        Specified by:
        isAbstract in interface JavaClass
        Returns:
        always returns false as JavaTypes are never abstract.
      • isAnnotation

        public boolean isAnnotation()
        Indicates if this JavaClass is an Annotation.
        Specified by:
        isAnnotation in interface JavaClass
        Returns:
        always returns false as JavaTypes are never Annotations.
      • isArray

        public boolean isArray()
        Indicates if this JavaClass is an Array type.
        Specified by:
        isArray in interface JavaClass
        Returns:
        always returns false, as JavaTypes do not represent arrays.
      • isAssignableFrom

        public boolean isAssignableFrom​(JavaClass arg0)
        Indicates if this JavaClass is either the same as, or is a superclass of, the javaClass argument.
        Specified by:
        isAssignableFrom in interface JavaClass
        Parameters:
        arg0 - the Class to test.
        Returns:
        true if this JavaClass is assignable from javaClass, otherwise false.
        See Also:
        Class.isAssignableFrom(Class)
      • 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
      • 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:
        always returns null, as JavaTypes do not have Annotations.
      • getAnnotations

        public java.util.Collection<JavaAnnotation> getAnnotations()
        Return all of the Annotations for this JavaClass.
        Specified by:
        getAnnotations in interface JavaHasAnnotations
        Returns:
        always returns an empty ArrayList, as JavaTypes do not have Annotations.
      • getDeclaredAnnotation

        public JavaAnnotation getDeclaredAnnotation​(JavaClass arg0)
        If this JavaClass declares an Annotation matching aClass, return its JavaAnnotation representation.
        Specified by:
        getDeclaredAnnotation in interface JavaHasAnnotations
        Parameters:
        arg0 - a JavaClass representing the Annotation to look for.
        Returns:
        always returns null, as JavaTypes do not have Annotations.
      • getDeclaredAnnotations

        public java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
        Return all of the declared Annotations for this JavaClass.
        Specified by:
        getDeclaredAnnotations in interface JavaHasAnnotations
        Returns:
        always returns an empty ArrayList, as JavaTypes do not have Annotations.
      • setJavaModel

        public void setJavaModel​(JavaModel model)
        Set this JavaClass' JavaModel.
        Parameters:
        model - The JavaModel to set.
      • getJavaModel

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