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:
JavaClass
implementation wrapping XJC'sJDefinedClass
. Used when bootstrapping aDynamicJAXBContext
from 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.JavaAnnotation
getAnnotation(JavaClass aClass)
If thisJavaClass
is annotated with anAnnotation
matchingaClass
, return itsJavaAnnotation
representation.java.util.Collection<JavaAnnotation>
getAnnotations()
Return all of theAnnotations
for thisJavaClass
.JavaClass
getComponentType()
If thisJavaClass
is an array type, return the type of the array components.JavaConstructor
getConstructor(JavaClass[] parameterTypes)
Return theJavaConstructor
for thisJavaClass
that has the provided parameter types.java.util.Collection<JavaConstructor>
getConstructors()
Return all of theJavaConstructors
for thisJavaClass
.JavaAnnotation
getDeclaredAnnotation(JavaClass arg0)
Not supported.java.util.Collection<JavaAnnotation>
getDeclaredAnnotations()
Not supported.java.util.Collection<JavaClass>
getDeclaredClasses()
Return thisJavaClass'
inner classes.JavaConstructor
getDeclaredConstructor(JavaClass[] parameterTypes)
Return the declaredJavaConstructor
for thisJavaClass
that has the provided parameter types.java.util.Collection<JavaConstructor>
getDeclaredConstructors()
Return all of the declaredJavaConstructors
for thisJavaClass
.JavaField
getDeclaredField(java.lang.String fieldName)
Return the declaredJavaField
for thisJavaClass
, identified byfieldName
.java.util.Collection<JavaField>
getDeclaredFields()
Return all of the declaredJavaFields
for thisJavaClass
.JavaMethod
getDeclaredMethod(java.lang.String name, JavaClass[] args)
Return the declaredJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.java.util.Collection<JavaMethod>
getDeclaredMethods()
Return all of the declaredJavaMethods
for thisJavaClass
.java.lang.reflect.Type[]
getGenericInterfaces()
java.lang.reflect.Type
getGenericSuperclass()
JavaModel
getJavaModel()
Get thisJavaClass'
JavaModel
.JavaMethod
getMethod(java.lang.String name, JavaClass[] args)
Return theJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.java.util.Collection<JavaMethod>
getMethods()
Return all of theJavaMethods
for thisJavaClass
.int
getModifiers()
Returns the Java language modifiers for thisJavaClass
, encoded in an integer.java.lang.String
getName()
Returns the name of thisJavaClass
.JavaPackage
getPackage()
Returns theJavaPackage
that thisJavaClass
belongs to.java.lang.String
getPackageName()
Returns the package name of thisJavaClass
.java.lang.String
getQualifiedName()
Returns the fully-qualified name of thisJavaClass
.java.lang.String
getRawName()
Returns the raw name of thisJavaClass
.JavaClass
getSuperclass()
Returns the super class of thisJavaClass
.boolean
hasActualTypeArguments()
Indicates if thisJavaClass
has actual type arguments, i.e. is a parameterized type (for example,List<Employee
).JavaClassInstanceOf
instanceOf()
boolean
isAbstract()
Indicates if thisJavaClass
isabstract
.boolean
isAnnotation()
Indicates if thisJavaClass
is anAnnotation
.boolean
isArray()
Indicates if thisJavaClass
is an Array type.boolean
isAssignableFrom(JavaClass javaClass)
Indicates if thisJavaClass
is either the same as, or is a superclass of, thejavaClass
argument.boolean
isEnum()
Indicates if thisJavaClass
is anenum
.boolean
isFinal()
Indicates if thisJavaClass
isfinal
.boolean
isInterface()
Indicates if thisJavaClass
is aninterface
.boolean
isMemberClass()
Indicates if thisJavaClass
is an innerClass
.boolean
isPrimitive()
Indicates if thisJavaClass
represents a primitive type.boolean
isPrivate()
Indicates if thisJavaClass
isprivate
.boolean
isProtected()
Indicates if thisJavaClass
isprotected
.boolean
isPublic()
Indicates if thisJavaClass
ispublic
.boolean
isStatic()
Indicates if thisJavaClass
isstatic
.boolean
isSynthetic()
Not supported.void
setActualTypeArgument(JavaClass javaClass)
void
setJavaModel(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 XJCJDefinedClass
to be wrapped.codeModel
- - the XJCJCodeModel
this class belongs to.loader
- - theClassLoader
used 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 XJCJDefinedClass
to be wrapped.codeModel
- - the XJCJCodeModel
this class belongs to.loader
- - theClassLoader
used 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 thisJavaClass
representsList<Employee
, this method will return theEmployee
JavaClass
.- Specified by:
getActualTypeArguments
in interfaceJavaClass
- Returns:
- a
Collection
containing the actual type'sJavaClass
.
-
getComponentType
public JavaClass getComponentType()
If thisJavaClass
is an array type, return the type of the array components.- Specified by:
getComponentType
in interfaceJavaClass
- Returns:
JavaClass
of this array's component type, ornull
if this is not an array type.
-
getConstructor
public JavaConstructor getConstructor(JavaClass[] parameterTypes)
Return theJavaConstructor
for thisJavaClass
that has the provided parameter types.- Specified by:
getConstructor
in interfaceJavaClass
- 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 theJavaConstructors
for thisJavaClass
.- Specified by:
getConstructors
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaConstructors
.
-
getDeclaredClasses
public java.util.Collection<JavaClass> getDeclaredClasses()
Return thisJavaClass'
inner classes.- Specified by:
getDeclaredClasses
in interfaceJavaClass
- Returns:
- A
Collection<JavaClass>
containing thisJavaClass'
inner classes.
-
getDeclaredConstructor
public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes)
Return the declaredJavaConstructor
for thisJavaClass
that has the provided parameter types.- Specified by:
getDeclaredConstructor
in interfaceJavaClass
- Parameters:
parameterTypes
- the parameter list used to identify the constructor.- Returns:
- the
JavaConstructor
with the signature matchingparameterTypes
.
-
getDeclaredConstructors
public java.util.Collection<JavaConstructor> getDeclaredConstructors()
Return all of the declaredJavaConstructors
for thisJavaClass
.- Specified by:
getDeclaredConstructors
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaConstructors
.
-
getDeclaredField
public JavaField getDeclaredField(java.lang.String fieldName)
Return the declaredJavaField
for thisJavaClass
, identified byfieldName
.- Specified by:
getDeclaredField
in interfaceJavaClass
- Parameters:
fieldName
- the name of theJavaField
to return.- Returns:
- the
JavaField
namedfieldName
from thisJavaClass
.
-
getDeclaredFields
public java.util.Collection<JavaField> getDeclaredFields()
Return all of the declaredJavaFields
for thisJavaClass
.- Specified by:
getDeclaredFields
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaFields
.
-
getDeclaredMethod
public JavaMethod getDeclaredMethod(java.lang.String name, JavaClass[] args)
Return the declaredJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.- Specified by:
getDeclaredMethod
in interfaceJavaClass
- Parameters:
name
- the name of theJavaMethod
to return.args
- the parameter list used to identify the method.- Returns:
- the matching
JavaMethod
from thisJavaClass
.
-
getDeclaredMethods
public java.util.Collection<JavaMethod> getDeclaredMethods()
Return all of the declaredJavaMethods
for thisJavaClass
.- Specified by:
getDeclaredMethods
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaMethods
.
-
getMethod
public JavaMethod getMethod(java.lang.String name, JavaClass[] args)
Return theJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.
-
getMethods
public java.util.Collection<JavaMethod> getMethods()
Return all of theJavaMethods
for thisJavaClass
.- Specified by:
getMethods
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaMethods
.
-
getModifiers
public int getModifiers()
Returns the Java language modifiers for thisJavaClass
, encoded in an integer.- Specified by:
getModifiers
in interfaceJavaClass
- Returns:
- the
int
representing the modifiers for this class. - See Also:
Modifier
-
getName
public java.lang.String getName()
Returns the name of thisJavaClass
.
-
getPackage
public JavaPackage getPackage()
Returns theJavaPackage
that thisJavaClass
belongs to.- Specified by:
getPackage
in interfaceJavaClass
- Returns:
- the
JavaPackage
of thisJavaClass
.
-
getPackageName
public java.lang.String getPackageName()
Returns the package name of thisJavaClass
.- Specified by:
getPackageName
in interfaceJavaClass
- Returns:
- the
String
name of thisJavaClass'
JavaPackage
.
-
getQualifiedName
public java.lang.String getQualifiedName()
Returns the fully-qualified name of thisJavaClass
.- Specified by:
getQualifiedName
in interfaceJavaClass
- Returns:
- the
String
name of thisJavaClass
.
-
getRawName
public java.lang.String getRawName()
Returns the raw name of thisJavaClass
. Array types will have "[]" appended to the name.- Specified by:
getRawName
in interfaceJavaClass
- Returns:
- the
String
raw name of thisJavaClass
.
-
getSuperclass
public JavaClass getSuperclass()
Returns the super class of thisJavaClass
.- Specified by:
getSuperclass
in interfaceJavaClass
- Returns:
JavaClass
representing the super class of thisJavaClass
.
-
getGenericInterfaces
public java.lang.reflect.Type[] getGenericInterfaces()
- Specified by:
getGenericInterfaces
in interfaceJavaClass
-
getGenericSuperclass
public java.lang.reflect.Type getGenericSuperclass()
- Specified by:
getGenericSuperclass
in interfaceJavaClass
-
hasActualTypeArguments
public boolean hasActualTypeArguments()
Indicates if thisJavaClass
has actual type arguments, i.e. is a parameterized type (for example,List<Employee
).- Specified by:
hasActualTypeArguments
in interfaceJavaClass
- Returns:
true
if thisJavaClass
is parameterized, otherwisefalse
.
-
isAbstract
public boolean isAbstract()
Indicates if thisJavaClass
isabstract
.- Specified by:
isAbstract
in interfaceJavaClass
- Returns:
true
if thisJavaClass
isabstract
, otherwisefalse
.
-
isAnnotation
public boolean isAnnotation()
Indicates if thisJavaClass
is anAnnotation
.- Specified by:
isAnnotation
in interfaceJavaClass
- Returns:
true
if thisJavaClass
is anAnnotation
, otherwisefalse
.
-
isArray
public boolean isArray()
Indicates if thisJavaClass
is an Array type.
-
isAssignableFrom
public boolean isAssignableFrom(JavaClass javaClass)
Indicates if thisJavaClass
is either the same as, or is a superclass of, thejavaClass
argument.- Specified by:
isAssignableFrom
in interfaceJavaClass
- Parameters:
javaClass
- theClass
to test.- Returns:
true
if thisJavaClass
is assignable fromjavaClass
, otherwisefalse
.- See Also:
Class.isAssignableFrom(Class)
-
isEnum
public boolean isEnum()
Indicates if thisJavaClass
is anenum
.
-
isFinal
public boolean isFinal()
Indicates if thisJavaClass
isfinal
.
-
isInterface
public boolean isInterface()
Indicates if thisJavaClass
is aninterface
.- Specified by:
isInterface
in interfaceJavaClass
- Returns:
true
if thisJavaClass
is aninterface
, otherwisefalse
.
-
isMemberClass
public boolean isMemberClass()
Indicates if thisJavaClass
is an innerClass
.- Specified by:
isMemberClass
in interfaceJavaClass
- Returns:
true
if thisJavaClass
is an innerClass
, otherwisefalse
.
-
isPrimitive
public boolean isPrimitive()
Indicates if thisJavaClass
represents a primitive type.- Specified by:
isPrimitive
in interfaceJavaClass
- Returns:
true
if thisJavaClass
represents a primitive type, otherwisefalse
.
-
isPrivate
public boolean isPrivate()
Indicates if thisJavaClass
isprivate
.
-
isProtected
public boolean isProtected()
Indicates if thisJavaClass
isprotected
.- Specified by:
isProtected
in interfaceJavaClass
- Returns:
true
if thisJavaClass
isprotected
, otherwisefalse
.
-
isPublic
public boolean isPublic()
Indicates if thisJavaClass
ispublic
.
-
isStatic
public boolean isStatic()
Indicates if thisJavaClass
isstatic
.
-
isSynthetic
public boolean isSynthetic()
Not supported.- Specified by:
isSynthetic
in interfaceJavaClass
-
instanceOf
public JavaClassInstanceOf instanceOf()
- Specified by:
instanceOf
in interfaceJavaClass
-
getAnnotation
public JavaAnnotation getAnnotation(JavaClass aClass)
If thisJavaClass
is annotated with anAnnotation
matchingaClass
, return itsJavaAnnotation
representation.- Specified by:
getAnnotation
in interfaceJavaHasAnnotations
- Parameters:
aClass
- aJavaClass
representing theAnnotation
to look for.- Returns:
- the
JavaAnnotation
represented byaClass
, if one exists, otherwise returnnull
.
-
getAnnotations
public java.util.Collection<JavaAnnotation> getAnnotations()
Return all of theAnnotations
for thisJavaClass
.- Specified by:
getAnnotations
in interfaceJavaHasAnnotations
- Returns:
- A
Collection
containing thisJavaClass'
JavaAnnotations
.
-
getDeclaredAnnotation
public JavaAnnotation getDeclaredAnnotation(JavaClass arg0)
Not supported.- Specified by:
getDeclaredAnnotation
in interfaceJavaHasAnnotations
-
getDeclaredAnnotations
public java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
Not supported.- Specified by:
getDeclaredAnnotations
in interfaceJavaHasAnnotations
-
getJavaModel
public JavaModel getJavaModel()
Get thisJavaClass'
JavaModel
.- Returns:
- The
JavaModel
associated with thisJavaClass
.
-
setJavaModel
public void setJavaModel(JavaModel javaModel)
Set thisJavaClass'
JavaModel
.- Parameters:
javaModel
- TheJavaModel
to set.
-
-