Class OXMJavaClassImpl
- java.lang.Object
-
- org.eclipse.persistence.jaxb.javamodel.oxm.OXMJavaClassImpl
-
- All Implemented Interfaces:
JavaClass
,JavaHasAnnotations
public class OXMJavaClassImpl extends java.lang.Object implements JavaClass
INTERNAL:Purpose:
JavaClass
implementation wrapping MOXy'sxmlmodel.JavaType
. Used when bootstrapping aDynamicJAXBContext
from XML Bindings.Responsibilities:
- Provide Class information from the underlying
JavaType
.
-
-
Constructor Summary
Constructors Constructor Description OXMJavaClassImpl(java.lang.String aJavaTypeName)
Construct a new instance ofOXMJavaClassImpl
.OXMJavaClassImpl(java.lang.String aJavaTypeName, java.util.List<java.lang.String> enumValues)
Construct a new instance ofOXMJavaClassImpl
representing a Javaenum
.OXMJavaClassImpl(JavaType aJavaType)
Construct a new instance ofOXMJavaClassImpl
.
-
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 this JavaClass.JavaAnnotation
getDeclaredAnnotation(JavaClass arg0)
If thisJavaClass
declares anAnnotation
matchingaClass
, return itsJavaAnnotation
representation.java.util.Collection<JavaAnnotation>
getDeclaredAnnotations()
Return all of the declaredAnnotations
for thisJavaClass
.java.util.Collection<JavaClass>
getDeclaredClasses()
Return thisJavaClass'
inner classes.JavaConstructor
getDeclaredConstructor(JavaClass[] parameterTypes)
Return the declaredJavaConstructor
for thisJavaClass
.java.util.Collection<JavaConstructor>
getDeclaredConstructors()
Return all of the declaredJavaConstructors
for thisJavaClass
.JavaField
getDeclaredField(java.lang.String name)
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 arg0)
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
setJavaModel(JavaModel model)
Set thisJavaClass'
JavaModel
.
-
-
-
Constructor Detail
-
OXMJavaClassImpl
public OXMJavaClassImpl(JavaType aJavaType)
Construct a new instance ofOXMJavaClassImpl
.- Parameters:
aJavaType
- - the XJCJavaType
to be wrapped.
-
OXMJavaClassImpl
public OXMJavaClassImpl(java.lang.String aJavaTypeName)
Construct a new instance ofOXMJavaClassImpl
.- Parameters:
aJavaTypeName
- - the name of the JavaType to create.
-
OXMJavaClassImpl
public OXMJavaClassImpl(java.lang.String aJavaTypeName, java.util.List<java.lang.String> enumValues)
Construct a new instance ofOXMJavaClassImpl
representing a Javaenum
.- Parameters:
aJavaTypeName
- - the name of the JavaType to create.enumValues
- - the list of values for thisenum
.
-
-
Method Detail
-
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:
- always returns
null
, asJavaTypes
do not represent arrays.
-
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 this JavaClass.- 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:
- always returns an empty
ArrayList
asJavaTypes
do not represent inner classes.
-
getDeclaredConstructor
public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes)
Return the declaredJavaConstructor
for thisJavaClass
.- Specified by:
getDeclaredConstructor
in interfaceJavaClass
- Returns:
- the
JavaConstructor
for thisJavaClass
.
-
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 name)
Return the declaredJavaField
for thisJavaClass
, identified byfieldName
.- Specified by:
getDeclaredField
in interfaceJavaClass
- Parameters:
name
- 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:
- always returns
null
, asJavaTypes
do not have methods.
-
getDeclaredMethods
public java.util.Collection<JavaMethod> getDeclaredMethods()
Return all of the declaredJavaMethods
for thisJavaClass
.- Specified by:
getDeclaredMethods
in interfaceJavaClass
- Returns:
- always returns an empty
ArrayList
, asJavaTypes
do not have methods.
-
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:
- always returns an empty
ArrayList
, asJavaTypes
do not have methods.
-
getModifiers
public int getModifiers()
Returns the Java language modifiers for thisJavaClass
, encoded in an integer.- Specified by:
getModifiers
in interfaceJavaClass
- Returns:
- always returns
0
asJavaTypes
do not have modifiers. - 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:
- always returns
false
asJavaTypes
are not parameterized.
-
isAbstract
public boolean isAbstract()
Indicates if thisJavaClass
isabstract
.- Specified by:
isAbstract
in interfaceJavaClass
- Returns:
- always returns
false
asJavaTypes
are neverabstract
.
-
isAnnotation
public boolean isAnnotation()
Indicates if thisJavaClass
is anAnnotation
.- Specified by:
isAnnotation
in interfaceJavaClass
- Returns:
- always returns
false
asJavaTypes
are neverAnnotations
.
-
isArray
public boolean isArray()
Indicates if thisJavaClass
is an Array type.
-
isAssignableFrom
public boolean isAssignableFrom(JavaClass arg0)
Indicates if thisJavaClass
is either the same as, or is a superclass of, thejavaClass
argument.- Specified by:
isAssignableFrom
in interfaceJavaClass
- Parameters:
arg0
- 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:
- always returns
null
, asJavaTypes
do not haveAnnotations
.
-
getAnnotations
public java.util.Collection<JavaAnnotation> getAnnotations()
Return all of theAnnotations
for thisJavaClass
.- Specified by:
getAnnotations
in interfaceJavaHasAnnotations
- Returns:
- always returns an empty
ArrayList
, asJavaTypes
do not haveAnnotations
.
-
getDeclaredAnnotation
public JavaAnnotation getDeclaredAnnotation(JavaClass arg0)
If thisJavaClass
declares anAnnotation
matchingaClass
, return itsJavaAnnotation
representation.- Specified by:
getDeclaredAnnotation
in interfaceJavaHasAnnotations
- Parameters:
arg0
- aJavaClass
representing theAnnotation
to look for.- Returns:
- always returns
null
, asJavaTypes
do not haveAnnotations
.
-
getDeclaredAnnotations
public java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
Return all of the declaredAnnotations
for thisJavaClass
.- Specified by:
getDeclaredAnnotations
in interfaceJavaHasAnnotations
- Returns:
- always returns an empty
ArrayList
, asJavaTypes
do not haveAnnotations
.
-
setJavaModel
public void setJavaModel(JavaModel model)
Set thisJavaClass'
JavaModel
.- Parameters:
model
- TheJavaModel
to set.
-
getJavaModel
public JavaModel getJavaModel()
Get thisJavaClass'
JavaModel
.- Returns:
- The
JavaModel
associated with thisJavaClass
.
-
-