Module org.eclipse.persistence.moxy
Class XJCJavaClassImpl
java.lang.Object
org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaClassImpl
- All Implemented Interfaces:
JavaClass,JavaHasAnnotations
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.
- Since:
- EclipseLink 2.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionXJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader) Construct a new instance ofXJCJavaClassImpl.XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader, boolean isArray, boolean isPrimitive) Construct a new instance ofXJCJavaClassImpl. -
Method Summary
Modifier and TypeMethodDescriptionReturn the "actual" type from a parameterized type.getAnnotation(JavaClass aClass) If thisJavaClassis annotated with anAnnotationmatchingaClass, return itsJavaAnnotationrepresentation.Return all of theAnnotationsfor thisJavaClass.If thisJavaClassis an array type, return the type of the array components.getConstructor(JavaClass[] parameterTypes) Return theJavaConstructorfor thisJavaClassthat has the provided parameter types.Return all of theJavaConstructorsfor thisJavaClass.Not supported.Not supported.Return thisJavaClass'inner classes.getDeclaredConstructor(JavaClass[] parameterTypes) Return the declaredJavaConstructorfor thisJavaClassthat has the provided parameter types.Return all of the declaredJavaConstructorsfor thisJavaClass.getDeclaredField(String fieldName) Return the declaredJavaFieldfor thisJavaClass, identified byfieldName.Return all of the declaredJavaFieldsfor thisJavaClass.getDeclaredMethod(String name, JavaClass[] args) Return the declaredJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.Return all of the declaredJavaMethodsfor thisJavaClass.Type[]Get thisJavaClass'JavaModel.Return theJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.Return all of theJavaMethodsfor thisJavaClass.intReturns the Java language modifiers for thisJavaClass, encoded in an integer.getName()Returns the name of thisJavaClass.Returns theJavaPackagethat thisJavaClassbelongs to.Returns the package name of thisJavaClass.Returns the fully-qualified name of thisJavaClass.Returns the raw name of thisJavaClass.Returns the super class of thisJavaClass.booleanIndicates if thisJavaClasshas actual type arguments, i.e.booleanIndicates if thisJavaClassisabstract.booleanIndicates if thisJavaClassis anAnnotation.booleanisArray()Indicates if thisJavaClassis an Array type.booleanisAssignableFrom(JavaClass javaClass) Indicates if thisJavaClassis either the same as, or is a superclass of, thejavaClassargument.booleanisEnum()Indicates if thisJavaClassis anenum.booleanisFinal()Indicates if thisJavaClassisfinal.booleanIndicates if thisJavaClassis aninterface.booleanIndicates if thisJavaClassis an innerClass.booleanIndicates if thisJavaClassrepresents a primitive type.booleanIndicates if thisJavaClassisprivate.booleanIndicates if thisJavaClassisprotected.booleanisPublic()Indicates if thisJavaClassispublic.booleanisStatic()Indicates if thisJavaClassisstatic.booleanNot supported.voidsetActualTypeArgument(JavaClass javaClass) voidsetJavaModel(JavaModel javaModel) Set thisJavaClass'JavaModel.
-
Constructor Details
-
XJCJavaClassImpl
public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader) Construct a new instance ofXJCJavaClassImpl.- Parameters:
jDefinedClass- - the XJCJDefinedClassto be wrapped.codeModel- - the XJCJCodeModelthis class belongs to.loader- - theClassLoaderused to bootstrap theDynamicJAXBContext.
-
XJCJavaClassImpl
public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader, boolean isArray, boolean isPrimitive) Construct a new instance ofXJCJavaClassImpl.- Parameters:
jDefinedClass- - the XJCJDefinedClassto be wrapped.codeModel- - the XJCJCodeModelthis class belongs to.loader- - theClassLoaderused to bootstrap theDynamicJAXBContext.isArray- - indicates that this class is an array type.isPrimitive- - indicates that this class is a primitive type.
-
-
Method Details
-
setActualTypeArgument
-
getActualTypeArguments
Return the "actual" type from a parameterized type. For example, if thisJavaClassrepresentsList<Employee, this method will return theEmployeeJavaClass.- Specified by:
getActualTypeArgumentsin interfaceJavaClass- Returns:
- a
Collectioncontaining the actual type'sJavaClass.
-
getComponentType
If thisJavaClassis an array type, return the type of the array components.- Specified by:
getComponentTypein interfaceJavaClass- Returns:
JavaClassof this array's component type, ornullif this is not an array type.
-
getConstructor
Return theJavaConstructorfor thisJavaClassthat has the provided parameter types.- Specified by:
getConstructorin interfaceJavaClass- Parameters:
parameterTypes- the parameter list used to identify the constructor.- Returns:
- the
JavaConstructorwith the signature matching parameterTypes.
-
getConstructors
Return all of theJavaConstructorsfor thisJavaClass.- Specified by:
getConstructorsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaConstructors.
-
getDeclaredClasses
Return thisJavaClass'inner classes.- Specified by:
getDeclaredClassesin interfaceJavaClass- Returns:
- A
Collection<JavaClass>containing thisJavaClass'inner classes.
-
getDeclaredConstructor
Return the declaredJavaConstructorfor thisJavaClassthat has the provided parameter types.- Specified by:
getDeclaredConstructorin interfaceJavaClass- Parameters:
parameterTypes- the parameter list used to identify the constructor.- Returns:
- the
JavaConstructorwith the signature matchingparameterTypes.
-
getDeclaredConstructors
Return all of the declaredJavaConstructorsfor thisJavaClass.- Specified by:
getDeclaredConstructorsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaConstructors.
-
getDeclaredField
Return the declaredJavaFieldfor thisJavaClass, identified byfieldName.- Specified by:
getDeclaredFieldin interfaceJavaClass- Parameters:
fieldName- the name of theJavaFieldto return.- Returns:
- the
JavaFieldnamedfieldNamefrom thisJavaClass.
-
getDeclaredFields
Return all of the declaredJavaFieldsfor thisJavaClass.- Specified by:
getDeclaredFieldsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaFields.
-
getDeclaredMethod
Return the declaredJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.- Specified by:
getDeclaredMethodin interfaceJavaClass- Parameters:
name- the name of theJavaMethodto return.args- the parameter list used to identify the method.- Returns:
- the matching
JavaMethodfrom thisJavaClass.
-
getDeclaredMethods
Return all of the declaredJavaMethodsfor thisJavaClass.- Specified by:
getDeclaredMethodsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaMethods.
-
getMethod
Return theJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs. -
getMethods
Return all of theJavaMethodsfor thisJavaClass.- Specified by:
getMethodsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaMethods.
-
getModifiers
public int getModifiers()Returns the Java language modifiers for thisJavaClass, encoded in an integer.- Specified by:
getModifiersin interfaceJavaClass- Returns:
- the
intrepresenting the modifiers for this class. - See Also:
-
getName
Returns the name of thisJavaClass. -
getPackage
Returns theJavaPackagethat thisJavaClassbelongs to.- Specified by:
getPackagein interfaceJavaClass- Returns:
- the
JavaPackageof thisJavaClass.
-
getPackageName
Returns the package name of thisJavaClass.- Specified by:
getPackageNamein interfaceJavaClass- Returns:
- the
Stringname of thisJavaClass'JavaPackage.
-
getQualifiedName
Returns the fully-qualified name of thisJavaClass.- Specified by:
getQualifiedNamein interfaceJavaClass- Returns:
- the
Stringname of thisJavaClass.
-
getRawName
Returns the raw name of thisJavaClass. Array types will have "[]" appended to the name.- Specified by:
getRawNamein interfaceJavaClass- Returns:
- the
Stringraw name of thisJavaClass.
-
getSuperclass
Returns the super class of thisJavaClass.- Specified by:
getSuperclassin interfaceJavaClass- Returns:
JavaClassrepresenting the super class of thisJavaClass.
-
getGenericInterfaces
- Specified by:
getGenericInterfacesin interfaceJavaClass
-
getGenericSuperclass
- Specified by:
getGenericSuperclassin interfaceJavaClass
-
hasActualTypeArguments
public boolean hasActualTypeArguments()Indicates if thisJavaClasshas actual type arguments, i.e. is a parameterized type (for example,List<Employee).- Specified by:
hasActualTypeArgumentsin interfaceJavaClass- Returns:
trueif thisJavaClassis parameterized, otherwisefalse.
-
isAbstract
public boolean isAbstract()Indicates if thisJavaClassisabstract.- Specified by:
isAbstractin interfaceJavaClass- Returns:
trueif thisJavaClassisabstract, otherwisefalse.
-
isAnnotation
public boolean isAnnotation()Indicates if thisJavaClassis anAnnotation.- Specified by:
isAnnotationin interfaceJavaClass- Returns:
trueif thisJavaClassis anAnnotation, otherwisefalse.
-
isArray
public boolean isArray()Indicates if thisJavaClassis an Array type. -
isAssignableFrom
Indicates if thisJavaClassis either the same as, or is a superclass of, thejavaClassargument.- Specified by:
isAssignableFromin interfaceJavaClass- Parameters:
javaClass- theClassto test.- Returns:
trueif thisJavaClassis assignable fromjavaClass, otherwisefalse.- See Also:
-
isEnum
public boolean isEnum()Indicates if thisJavaClassis anenum. -
isFinal
public boolean isFinal()Indicates if thisJavaClassisfinal. -
isInterface
public boolean isInterface()Indicates if thisJavaClassis aninterface.- Specified by:
isInterfacein interfaceJavaClass- Returns:
trueif thisJavaClassis aninterface, otherwisefalse.
-
isMemberClass
public boolean isMemberClass()Indicates if thisJavaClassis an innerClass.- Specified by:
isMemberClassin interfaceJavaClass- Returns:
trueif thisJavaClassis an innerClass, otherwisefalse.
-
isPrimitive
public boolean isPrimitive()Indicates if thisJavaClassrepresents a primitive type.- Specified by:
isPrimitivein interfaceJavaClass- Returns:
trueif thisJavaClassrepresents a primitive type, otherwisefalse.
-
isPrivate
public boolean isPrivate()Indicates if thisJavaClassisprivate. -
isProtected
public boolean isProtected()Indicates if thisJavaClassisprotected.- Specified by:
isProtectedin interfaceJavaClass- Returns:
trueif thisJavaClassisprotected, otherwisefalse.
-
isPublic
public boolean isPublic()Indicates if thisJavaClassispublic. -
isStatic
public boolean isStatic()Indicates if thisJavaClassisstatic. -
isSynthetic
public boolean isSynthetic()Not supported.- Specified by:
isSyntheticin interfaceJavaClass
-
instanceOf
- Specified by:
instanceOfin interfaceJavaClass
-
getAnnotation
If thisJavaClassis annotated with anAnnotationmatchingaClass, return itsJavaAnnotationrepresentation.- Specified by:
getAnnotationin interfaceJavaHasAnnotations- Parameters:
aClass- aJavaClassrepresenting theAnnotationto look for.- Returns:
- the
JavaAnnotationrepresented byaClass, if one exists, otherwise returnnull.
-
getAnnotations
Return all of theAnnotationsfor thisJavaClass.- Specified by:
getAnnotationsin interfaceJavaHasAnnotations- Returns:
- A
Collectioncontaining thisJavaClass'JavaAnnotations.
-
getDeclaredAnnotation
Not supported.- Specified by:
getDeclaredAnnotationin interfaceJavaHasAnnotations
-
getDeclaredAnnotations
Not supported.- Specified by:
getDeclaredAnnotationsin interfaceJavaHasAnnotations
-
getJavaModel
Get thisJavaClass'JavaModel.- Returns:
- The
JavaModelassociated with thisJavaClass.
-
setJavaModel
Set thisJavaClass'JavaModel.- Parameters:
javaModel- TheJavaModelto set.
-