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
ConstructorDescriptionXJCJavaClassImpl
(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 thisJavaClass
is annotated with anAnnotation
matchingaClass
, return itsJavaAnnotation
representation.Return all of theAnnotations
for thisJavaClass
.If thisJavaClass
is an array type, return the type of the array components.getConstructor
(JavaClass[] parameterTypes) Return theJavaConstructor
for thisJavaClass
that has the provided parameter types.Return all of theJavaConstructors
for thisJavaClass
.Not supported.Not supported.Return thisJavaClass'
inner classes.getDeclaredConstructor
(JavaClass[] parameterTypes) Return the declaredJavaConstructor
for thisJavaClass
that has the provided parameter types.Return all of the declaredJavaConstructors
for thisJavaClass
.getDeclaredField
(String fieldName) Return the declaredJavaField
for thisJavaClass
, identified byfieldName
.Return all of the declaredJavaFields
for thisJavaClass
.getDeclaredMethod
(String name, JavaClass[] args) Return the declaredJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.Return all of the declaredJavaMethods
for thisJavaClass
.Type[]
Get thisJavaClass'
JavaModel
.Return theJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
.Return all of theJavaMethods
for thisJavaClass
.int
Returns the Java language modifiers for thisJavaClass
, encoded in an integer.getName()
Returns the name of thisJavaClass
.Returns theJavaPackage
that thisJavaClass
belongs 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
.boolean
Indicates if thisJavaClass
has actual type arguments, i.e.boolean
Indicates if thisJavaClass
isabstract
.boolean
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
Indicates if thisJavaClass
is aninterface
.boolean
Indicates if thisJavaClass
is an innerClass
.boolean
Indicates if thisJavaClass
represents a primitive type.boolean
Indicates if thisJavaClass
isprivate
.boolean
Indicates if thisJavaClass
isprotected
.boolean
isPublic()
Indicates if thisJavaClass
ispublic
.boolean
isStatic()
Indicates if thisJavaClass
isstatic
.boolean
Not supported.void
setActualTypeArgument
(JavaClass javaClass) void
setJavaModel
(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 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 Details
-
setActualTypeArgument
-
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
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
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
Return all of theJavaConstructors
for thisJavaClass
.- Specified by:
getConstructors
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaConstructors
.
-
getDeclaredClasses
Return thisJavaClass'
inner classes.- Specified by:
getDeclaredClasses
in interfaceJavaClass
- Returns:
- A
Collection<JavaClass>
containing thisJavaClass'
inner classes.
-
getDeclaredConstructor
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
Return all of the declaredJavaConstructors
for thisJavaClass
.- Specified by:
getDeclaredConstructors
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaConstructors
.
-
getDeclaredField
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
Return all of the declaredJavaFields
for thisJavaClass
.- Specified by:
getDeclaredFields
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaFields
.
-
getDeclaredMethod
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
Return all of the declaredJavaMethods
for thisJavaClass
.- Specified by:
getDeclaredMethods
in interfaceJavaClass
- Returns:
- A
Collection
containing thisJavaClass'
JavaMethods
.
-
getMethod
Return theJavaMethod
for thisJavaClass
, identified byname
, with the signature matchingargs
. -
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:
-
getName
Returns the name of thisJavaClass
. -
getPackage
Returns theJavaPackage
that thisJavaClass
belongs to.- Specified by:
getPackage
in interfaceJavaClass
- Returns:
- the
JavaPackage
of thisJavaClass
.
-
getPackageName
Returns the package name of thisJavaClass
.- Specified by:
getPackageName
in interfaceJavaClass
- Returns:
- the
String
name of thisJavaClass'
JavaPackage
.
-
getQualifiedName
Returns the fully-qualified name of thisJavaClass
.- Specified by:
getQualifiedName
in interfaceJavaClass
- Returns:
- the
String
name of thisJavaClass
.
-
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
Returns the super class of thisJavaClass
.- Specified by:
getSuperclass
in interfaceJavaClass
- Returns:
JavaClass
representing the super class of thisJavaClass
.
-
getGenericInterfaces
- Specified by:
getGenericInterfaces
in interfaceJavaClass
-
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
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:
-
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
- Specified by:
instanceOf
in interfaceJavaClass
-
getAnnotation
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
Return all of theAnnotations
for thisJavaClass
.- Specified by:
getAnnotations
in interfaceJavaHasAnnotations
- Returns:
- A
Collection
containing thisJavaClass'
JavaAnnotations
.
-
getDeclaredAnnotation
Not supported.- Specified by:
getDeclaredAnnotation
in interfaceJavaHasAnnotations
-
getDeclaredAnnotations
Not supported.- Specified by:
getDeclaredAnnotations
in interfaceJavaHasAnnotations
-
getJavaModel
Get thisJavaClass'
JavaModel
.- Returns:
- The
JavaModel
associated with thisJavaClass
.
-
setJavaModel
Set thisJavaClass'
JavaModel
.- Parameters:
javaModel
- TheJavaModel
to set.
-