public class XJCJavaClassImpl extends java.lang.Object implements JavaClass
Purpose: JavaClass
implementation wrapping XJC's JDefinedClass
.
Used when bootstrapping a DynamicJAXBContext
from an XML Schema.
Responsibilities:
JDefinedClass
.JavaClass
Constructor and Description |
---|
XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass,
com.sun.codemodel.JCodeModel codeModel,
DynamicClassLoader loader)
Construct a new instance of
XJCJavaClassImpl . |
XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass,
com.sun.codemodel.JCodeModel codeModel,
DynamicClassLoader loader,
boolean isArray,
boolean isPrimitive)
Construct a new instance of
XJCJavaClassImpl . |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<JavaClass> |
getActualTypeArguments()
Return the "actual" type from a parameterized type.
|
JavaAnnotation |
getAnnotation(JavaClass aClass)
If this
JavaClass is annotated with an Annotation matching aClass ,
return its JavaAnnotation representation. |
java.util.Collection<JavaAnnotation> |
getAnnotations()
Return all of the
Annotations for this JavaClass . |
JavaClass |
getComponentType()
If this
JavaClass is an array type, return the type of the
array components. |
JavaConstructor |
getConstructor(JavaClass[] parameterTypes)
Return the
JavaConstructor for this JavaClass that has the
provided parameter types. |
java.util.Collection<JavaConstructor> |
getConstructors()
Return all of the
JavaConstructors for this JavaClass . |
JavaAnnotation |
getDeclaredAnnotation(JavaClass arg0)
Not supported.
|
java.util.Collection<JavaAnnotation> |
getDeclaredAnnotations()
Not supported.
|
java.util.Collection<JavaClass> |
getDeclaredClasses()
Return this
JavaClass' inner classes. |
JavaConstructor |
getDeclaredConstructor(JavaClass[] parameterTypes)
Return the declared
JavaConstructor for this JavaClass that has the
provided parameter types. |
java.util.Collection<JavaConstructor> |
getDeclaredConstructors()
Return all of the declared
JavaConstructors for this JavaClass . |
JavaField |
getDeclaredField(java.lang.String fieldName)
Return the declared
JavaField for this JavaClass , identified
by fieldName . |
java.util.Collection<JavaField> |
getDeclaredFields()
Return all of the declared
JavaFields for this JavaClass . |
JavaMethod |
getDeclaredMethod(java.lang.String name,
JavaClass[] args)
Return the declared
JavaMethod for this JavaClass ,
identified by name , with the signature matching args . |
java.util.Collection<JavaMethod> |
getDeclaredMethods()
Return all of the declared
JavaMethods for this JavaClass . |
java.lang.reflect.Type[] |
getGenericInterfaces() |
java.lang.reflect.Type |
getGenericSuperclass() |
JavaModel |
getJavaModel()
Get this
JavaClass' JavaModel . |
JavaMethod |
getMethod(java.lang.String name,
JavaClass[] args)
Return the
JavaMethod for this JavaClass , identified
by name , with the signature matching args . |
java.util.Collection<JavaMethod> |
getMethods()
Return all of the
JavaMethods for this JavaClass . |
int |
getModifiers()
Returns the Java language modifiers for this
JavaClass , encoded in an integer. |
java.lang.String |
getName()
Returns the name of this
JavaClass . |
JavaPackage |
getPackage()
Returns the
JavaPackage that this JavaClass belongs to. |
java.lang.String |
getPackageName()
Returns the package name of this
JavaClass . |
java.lang.String |
getQualifiedName()
Returns the fully-qualified name of this
JavaClass . |
java.lang.String |
getRawName()
Returns the raw name of this
JavaClass . |
JavaClass |
getSuperclass()
Returns the super class of this
JavaClass . |
boolean |
hasActualTypeArguments()
Indicates if this
JavaClass has actual type arguments, i.e. is a
parameterized type (for example, List<Employee ). |
JavaClassInstanceOf |
instanceOf() |
boolean |
isAbstract()
Indicates if this
JavaClass is abstract . |
boolean |
isAnnotation()
Indicates if this
JavaClass is an Annotation . |
boolean |
isArray()
Indicates if this
JavaClass is an Array type. |
boolean |
isAssignableFrom(JavaClass javaClass)
Indicates if this
JavaClass is either the same as, or is a superclass of,
the javaClass argument. |
boolean |
isEnum()
Indicates if this
JavaClass is an enum . |
boolean |
isFinal()
Indicates if this
JavaClass is final . |
boolean |
isInterface()
Indicates if this
JavaClass is an interface . |
boolean |
isMemberClass()
Indicates if this
JavaClass is an inner Class . |
boolean |
isPrimitive()
Indicates if this
JavaClass represents a primitive type. |
boolean |
isPrivate()
Indicates if this
JavaClass is private . |
boolean |
isProtected()
Indicates if this
JavaClass is protected . |
boolean |
isPublic()
Indicates if this
JavaClass is public . |
boolean |
isStatic()
Indicates if this
JavaClass is static . |
boolean |
isSynthetic()
Not supported.
|
void |
setActualTypeArgument(JavaClass javaClass) |
void |
setJavaModel(JavaModel javaModel)
Set this
JavaClass' JavaModel . |
public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader)
XJCJavaClassImpl
.jDefinedClass
- - the XJC JDefinedClass
to be wrapped.codeModel
- - the XJC JCodeModel
this class belongs to.loader
- - the ClassLoader
used to bootstrap the DynamicJAXBContext
.public XJCJavaClassImpl(com.sun.codemodel.JDefinedClass jDefinedClass, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader, boolean isArray, boolean isPrimitive)
XJCJavaClassImpl
.jDefinedClass
- - the XJC JDefinedClass
to be wrapped.codeModel
- - the XJC JCodeModel
this class belongs to.loader
- - the ClassLoader
used to bootstrap the DynamicJAXBContext
.isArray
- - indicates that this class is an array type.isPrimitive
- - indicates that this class is a primitive type.public void setActualTypeArgument(JavaClass javaClass)
public java.util.Collection<JavaClass> getActualTypeArguments()
JavaClass
represents List<Employee
, this method will return the
Employee
JavaClass
.getActualTypeArguments
in interface JavaClass
Collection
containing the actual type's JavaClass
.public JavaClass getComponentType()
JavaClass
is an array type, return the type of the
array components.getComponentType
in interface JavaClass
JavaClass
of this array's component type, or null
if
this is not an array type.public JavaConstructor getConstructor(JavaClass[] parameterTypes)
JavaConstructor
for this JavaClass
that has the
provided parameter types.getConstructor
in interface JavaClass
parameterTypes
- the parameter list used to identify the constructor.JavaConstructor
with the signature matching parameterTypes.public java.util.Collection<JavaConstructor> getConstructors()
JavaConstructors
for this JavaClass
.getConstructors
in interface JavaClass
Collection
containing this JavaClass'
JavaConstructors
.public java.util.Collection<JavaClass> getDeclaredClasses()
JavaClass'
inner classes.getDeclaredClasses
in interface JavaClass
Collection<JavaClass>
containing this JavaClass'
inner classes.public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes)
JavaConstructor
for this JavaClass
that has the
provided parameter types.getDeclaredConstructor
in interface JavaClass
parameterTypes
- the parameter list used to identify the constructor.JavaConstructor
with the signature matching parameterTypes
.public java.util.Collection<JavaConstructor> getDeclaredConstructors()
JavaConstructors
for this JavaClass
.getDeclaredConstructors
in interface JavaClass
Collection
containing this JavaClass'
JavaConstructors
.public JavaField getDeclaredField(java.lang.String fieldName)
JavaField
for this JavaClass
, identified
by fieldName
.getDeclaredField
in interface JavaClass
fieldName
- the name of the JavaField
to return.JavaField
named fieldName
from this JavaClass
.public java.util.Collection<JavaField> getDeclaredFields()
JavaFields
for this JavaClass
.getDeclaredFields
in interface JavaClass
Collection
containing this JavaClass'
JavaFields
.public JavaMethod getDeclaredMethod(java.lang.String name, JavaClass[] args)
JavaMethod
for this JavaClass
,
identified by name
, with the signature matching args
.getDeclaredMethod
in interface JavaClass
name
- the name of the JavaMethod
to return.args
- the parameter list used to identify the method.JavaMethod
from this JavaClass
.public java.util.Collection<JavaMethod> getDeclaredMethods()
JavaMethods
for this JavaClass
.getDeclaredMethods
in interface JavaClass
Collection
containing this JavaClass'
JavaMethods
.public JavaMethod getMethod(java.lang.String name, JavaClass[] args)
JavaMethod
for this JavaClass
, identified
by name
, with the signature matching args
.public java.util.Collection<JavaMethod> getMethods()
JavaMethods
for this JavaClass
.getMethods
in interface JavaClass
Collection
containing this JavaClass'
JavaMethods
.public int getModifiers()
JavaClass
, encoded in an integer.getModifiers
in interface JavaClass
int
representing the modifiers for this class.Modifier
public java.lang.String getName()
JavaClass
.public JavaPackage getPackage()
JavaPackage
that this JavaClass
belongs to.getPackage
in interface JavaClass
JavaPackage
of this JavaClass
.public java.lang.String getPackageName()
JavaClass
.getPackageName
in interface JavaClass
String
name of this JavaClass'
JavaPackage
.public java.lang.String getQualifiedName()
JavaClass
.getQualifiedName
in interface JavaClass
String
name of this JavaClass
.public java.lang.String getRawName()
JavaClass
. Array types will
have "[]" appended to the name.getRawName
in interface JavaClass
String
raw name of this JavaClass
.public JavaClass getSuperclass()
JavaClass
.getSuperclass
in interface JavaClass
JavaClass
representing the super class of this JavaClass
.public java.lang.reflect.Type[] getGenericInterfaces()
getGenericInterfaces
in interface JavaClass
public java.lang.reflect.Type getGenericSuperclass()
getGenericSuperclass
in interface JavaClass
public boolean hasActualTypeArguments()
JavaClass
has actual type arguments, i.e. is a
parameterized type (for example, List<Employee
).hasActualTypeArguments
in interface JavaClass
true
if this JavaClass
is parameterized, otherwise false
.public boolean isAbstract()
JavaClass
is abstract
.isAbstract
in interface JavaClass
true
if this JavaClass
is abstract
, otherwise false
.public boolean isAnnotation()
JavaClass
is an Annotation
.isAnnotation
in interface JavaClass
true
if this JavaClass
is an Annotation
, otherwise false
.public boolean isArray()
JavaClass
is an Array type.public boolean isAssignableFrom(JavaClass javaClass)
JavaClass
is either the same as, or is a superclass of,
the javaClass
argument.isAssignableFrom
in interface JavaClass
javaClass
- the Class
to test.true
if this JavaClass
is assignable from
javaClass
, otherwise false
.Class.isAssignableFrom(Class)
public boolean isEnum()
JavaClass
is an enum
.public boolean isFinal()
JavaClass
is final
.public boolean isInterface()
JavaClass
is an interface
.isInterface
in interface JavaClass
true
if this JavaClass
is an interface
, otherwise false
.public boolean isMemberClass()
JavaClass
is an inner Class
.isMemberClass
in interface JavaClass
true
if this JavaClass
is an inner Class
, otherwise false
.public boolean isPrimitive()
JavaClass
represents a primitive type.isPrimitive
in interface JavaClass
true
if this JavaClass
represents a primitive type, otherwise false
.public boolean isPrivate()
JavaClass
is private
.public boolean isProtected()
JavaClass
is protected
.isProtected
in interface JavaClass
true
if this JavaClass
is protected
, otherwise false
.public boolean isPublic()
JavaClass
is public
.public boolean isStatic()
JavaClass
is static
.public boolean isSynthetic()
isSynthetic
in interface JavaClass
public JavaClassInstanceOf instanceOf()
instanceOf
in interface JavaClass
public JavaAnnotation getAnnotation(JavaClass aClass)
JavaClass
is annotated with an Annotation
matching aClass
,
return its JavaAnnotation
representation.getAnnotation
in interface JavaHasAnnotations
aClass
- a JavaClass
representing the Annotation
to look for.JavaAnnotation
represented by aClass
, if one exists, otherwise return null
.public java.util.Collection<JavaAnnotation> getAnnotations()
Annotations
for this JavaClass
.getAnnotations
in interface JavaHasAnnotations
Collection
containing this JavaClass'
JavaAnnotations
.public JavaAnnotation getDeclaredAnnotation(JavaClass arg0)
getDeclaredAnnotation
in interface JavaHasAnnotations
public java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
getDeclaredAnnotations
in interface JavaHasAnnotations
public JavaModel getJavaModel()
JavaClass'
JavaModel
.JavaModel
associated with this JavaClass
.public void setJavaModel(JavaModel javaModel)
JavaClass'
JavaModel
.javaModel
- The JavaModel
to set.