Class XJCJavaClassImpl
- java.lang.Object
-
- org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaClassImpl
-
- All Implemented Interfaces:
JavaClass,JavaHasAnnotations
public class XJCJavaClassImpl extends java.lang.Object implements JavaClass
INTERNAL:Purpose:
JavaClassimplementation wrapping XJC'sJDefinedClass. Used when bootstrapping aDynamicJAXBContextfrom an XML Schema.Responsibilities:
- Provide Class information from the underlying
JDefinedClass.
- See Also:
JavaClass- Since:
- EclipseLink 2.1
-
-
Constructor Summary
Constructors Constructor Description XJCJavaClassImpl(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<JavaClass>getActualTypeArguments()Return the "actual" type from a parameterized type.JavaAnnotationgetAnnotation(JavaClass aClass)If thisJavaClassis annotated with anAnnotationmatchingaClass, return itsJavaAnnotationrepresentation.java.util.Collection<JavaAnnotation>getAnnotations()Return all of theAnnotationsfor thisJavaClass.JavaClassgetComponentType()If thisJavaClassis an array type, return the type of the array components.JavaConstructorgetConstructor(JavaClass[] parameterTypes)Return theJavaConstructorfor thisJavaClassthat has the provided parameter types.java.util.Collection<JavaConstructor>getConstructors()Return all of theJavaConstructorsfor thisJavaClass.JavaAnnotationgetDeclaredAnnotation(JavaClass arg0)Not supported.java.util.Collection<JavaAnnotation>getDeclaredAnnotations()Not supported.java.util.Collection<JavaClass>getDeclaredClasses()Return thisJavaClass'inner classes.JavaConstructorgetDeclaredConstructor(JavaClass[] parameterTypes)Return the declaredJavaConstructorfor thisJavaClassthat has the provided parameter types.java.util.Collection<JavaConstructor>getDeclaredConstructors()Return all of the declaredJavaConstructorsfor thisJavaClass.JavaFieldgetDeclaredField(java.lang.String fieldName)Return the declaredJavaFieldfor thisJavaClass, identified byfieldName.java.util.Collection<JavaField>getDeclaredFields()Return all of the declaredJavaFieldsfor thisJavaClass.JavaMethodgetDeclaredMethod(java.lang.String name, JavaClass[] args)Return the declaredJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.java.util.Collection<JavaMethod>getDeclaredMethods()Return all of the declaredJavaMethodsfor thisJavaClass.java.lang.reflect.Type[]getGenericInterfaces()java.lang.reflect.TypegetGenericSuperclass()JavaModelgetJavaModel()Get thisJavaClass'JavaModel.JavaMethodgetMethod(java.lang.String name, JavaClass[] args)Return theJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.java.util.Collection<JavaMethod>getMethods()Return all of theJavaMethodsfor thisJavaClass.intgetModifiers()Returns the Java language modifiers for thisJavaClass, encoded in an integer.java.lang.StringgetName()Returns the name of thisJavaClass.JavaPackagegetPackage()Returns theJavaPackagethat thisJavaClassbelongs to.java.lang.StringgetPackageName()Returns the package name of thisJavaClass.java.lang.StringgetQualifiedName()Returns the fully-qualified name of thisJavaClass.java.lang.StringgetRawName()Returns the raw name of thisJavaClass.JavaClassgetSuperclass()Returns the super class of thisJavaClass.booleanhasActualTypeArguments()Indicates if thisJavaClasshas actual type arguments, i.e. is a parameterized type (for example,List<Employee).JavaClassInstanceOfinstanceOf()booleanisAbstract()Indicates if thisJavaClassisabstract.booleanisAnnotation()Indicates 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.booleanisInterface()Indicates if thisJavaClassis aninterface.booleanisMemberClass()Indicates if thisJavaClassis an innerClass.booleanisPrimitive()Indicates if thisJavaClassrepresents a primitive type.booleanisPrivate()Indicates if thisJavaClassisprivate.booleanisProtected()Indicates if thisJavaClassisprotected.booleanisPublic()Indicates if thisJavaClassispublic.booleanisStatic()Indicates if thisJavaClassisstatic.booleanisSynthetic()Not supported.voidsetActualTypeArgument(JavaClass javaClass)voidsetJavaModel(JavaModel javaModel)Set thisJavaClass'JavaModel.
-
-
-
Constructor Detail
-
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 Detail
-
setActualTypeArgument
public void setActualTypeArgument(JavaClass javaClass)
-
getActualTypeArguments
public java.util.Collection<JavaClass> 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
public JavaClass 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
public JavaConstructor getConstructor(JavaClass[] parameterTypes)
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
public java.util.Collection<JavaConstructor> getConstructors()
Return all of theJavaConstructorsfor thisJavaClass.- Specified by:
getConstructorsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaConstructors.
-
getDeclaredClasses
public java.util.Collection<JavaClass> getDeclaredClasses()
Return thisJavaClass'inner classes.- Specified by:
getDeclaredClassesin interfaceJavaClass- Returns:
- A
Collection<JavaClass>containing thisJavaClass'inner classes.
-
getDeclaredConstructor
public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes)
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
public java.util.Collection<JavaConstructor> getDeclaredConstructors()
Return all of the declaredJavaConstructorsfor thisJavaClass.- Specified by:
getDeclaredConstructorsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaConstructors.
-
getDeclaredField
public JavaField getDeclaredField(java.lang.String fieldName)
Return the declaredJavaFieldfor thisJavaClass, identified byfieldName.- Specified by:
getDeclaredFieldin interfaceJavaClass- Parameters:
fieldName- the name of theJavaFieldto return.- Returns:
- the
JavaFieldnamedfieldNamefrom thisJavaClass.
-
getDeclaredFields
public java.util.Collection<JavaField> getDeclaredFields()
Return all of the declaredJavaFieldsfor thisJavaClass.- Specified by:
getDeclaredFieldsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaFields.
-
getDeclaredMethod
public JavaMethod getDeclaredMethod(java.lang.String name, JavaClass[] args)
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
public java.util.Collection<JavaMethod> getDeclaredMethods()
Return all of the declaredJavaMethodsfor thisJavaClass.- Specified by:
getDeclaredMethodsin interfaceJavaClass- Returns:
- A
Collectioncontaining thisJavaClass'JavaMethods.
-
getMethod
public JavaMethod getMethod(java.lang.String name, JavaClass[] args)
Return theJavaMethodfor thisJavaClass, identified byname, with the signature matchingargs.
-
getMethods
public java.util.Collection<JavaMethod> 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:
Modifier
-
getName
public java.lang.String getName()
Returns the name of thisJavaClass.
-
getPackage
public JavaPackage getPackage()
Returns theJavaPackagethat thisJavaClassbelongs to.- Specified by:
getPackagein interfaceJavaClass- Returns:
- the
JavaPackageof thisJavaClass.
-
getPackageName
public java.lang.String getPackageName()
Returns the package name of thisJavaClass.- Specified by:
getPackageNamein interfaceJavaClass- Returns:
- the
Stringname of thisJavaClass'JavaPackage.
-
getQualifiedName
public java.lang.String getQualifiedName()
Returns the fully-qualified name of thisJavaClass.- Specified by:
getQualifiedNamein interfaceJavaClass- Returns:
- the
Stringname of thisJavaClass.
-
getRawName
public java.lang.String 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
public JavaClass getSuperclass()
Returns the super class of thisJavaClass.- Specified by:
getSuperclassin interfaceJavaClass- Returns:
JavaClassrepresenting the super class of thisJavaClass.
-
getGenericInterfaces
public java.lang.reflect.Type[] getGenericInterfaces()
- Specified by:
getGenericInterfacesin interfaceJavaClass
-
getGenericSuperclass
public java.lang.reflect.Type 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
public boolean isAssignableFrom(JavaClass javaClass)
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:
Class.isAssignableFrom(Class)
-
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
public JavaClassInstanceOf instanceOf()
- Specified by:
instanceOfin interfaceJavaClass
-
getAnnotation
public JavaAnnotation getAnnotation(JavaClass aClass)
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
public java.util.Collection<JavaAnnotation> getAnnotations()
Return all of theAnnotationsfor thisJavaClass.- Specified by:
getAnnotationsin interfaceJavaHasAnnotations- Returns:
- A
Collectioncontaining thisJavaClass'JavaAnnotations.
-
getDeclaredAnnotation
public JavaAnnotation getDeclaredAnnotation(JavaClass arg0)
Not supported.- Specified by:
getDeclaredAnnotationin interfaceJavaHasAnnotations
-
getDeclaredAnnotations
public java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
Not supported.- Specified by:
getDeclaredAnnotationsin interfaceJavaHasAnnotations
-
getJavaModel
public JavaModel getJavaModel()
Get thisJavaClass'JavaModel.- Returns:
- The
JavaModelassociated with thisJavaClass.
-
setJavaModel
public void setJavaModel(JavaModel javaModel)
Set thisJavaClass'JavaModel.- Parameters:
javaModel- TheJavaModelto set.
-
-