Class ArrayClassImpl
- java.lang.Object
-
- org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.BuiltinClassImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.ArrayClassImpl
-
- All Implemented Interfaces:
java.lang.Comparable
,JAnnotatedElement
,JClass
,JElement
,JMember
,MAnnotatedElement
,MClass
,MElement
,MMember
public final class ArrayClassImpl extends BuiltinClassImpl
-
-
Field Summary
-
Fields inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JClass
createClassForFD(java.lang.String arrayFD, JamClassLoader loader)
Creates an array JClass from a field descriptor as described in the JLS.JClass
getArrayComponentType()
Returns the Class representing the component type of an array.int
getArrayDimensions()
If this JClass represents an array type (isArray() == true), returns the number of dimensions in the array.java.lang.String
getFieldDescriptor()
Returns the name of this member in the format described in section 4.3.2 of the VM spec, 'Field Descriptors.' This is the same nasty format returned by java.lang.Class.getName(), and is the format you need to use in calls to Class.forName().java.lang.String
getQualifiedName()
Returns a qualified name for this abstraction.java.lang.String
getSimpleName()
Returns a simple name of this abstraction.JClass
getSuperclass()
Returns the Class representing the superclass of the entity (class, interface, primitive type or void) represented by this Class.boolean
isArrayType()
Returns true if this JClass represents an array type.boolean
isAssignableFrom(JClass c)
Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.static java.lang.String
normalizeArrayName(java.lang.String declaration)
Returns the normal form for a given array name.-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.BuiltinClassImpl
accept, accept, addInterface, addInterface, addInterfaceUnqualified, addNewConstructor, addNewDeclaredProperty, addNewField, addNewInnerClass, addNewMethod, addNewProperty, equals, forName, getClasses, getConstructors, getContainingClass, getContainingPackage, getDeclaredFields, getDeclaredMethods, getDeclaredProperties, getFields, getImportedClasses, getImportedPackages, getInterfaces, getMethods, getModifiers, getMutableConstructors, getMutableFields, getMutableMethods, getPrimitiveClass, getProperties, getSourcePosition, hashCode, isAbstract, isAnnotationType, isBuiltinType, isEnumType, isFinal, isInterface, isObjectType, isPackagePrivate, isPrimitiveType, isPrivate, isProtected, isPublic, isStatic, isUnresolvedType, isVoidType, removeConstructor, removeDeclaredProperty, removeField, removeInnerClass, removeInterface, removeInterface, removeMethod, removeProperty, setIsAnnotationType, setIsEnumType, setIsInterface, setIsUnresolvedType, setModifiers, setSimpleName, setSuperclass, setSuperclass, setSuperclassUnqualified
-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
addAnnotationForProxy, addLiteralAnnotation, createComment, findOrCreateAnnotation, getAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getComment, getEditableProxy, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeAnnotation, removeComment
-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
compareTo, createSourcePosition, defaultName, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, removeSourcePosition, setArtifact, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JAnnotatedElement
getAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getComment
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JClass
getClassLoader
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JElement
getArtifact, getParent, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MAnnotatedElement
addLiteralAnnotation, createComment, findOrCreateAnnotation, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeComment
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MElement
createSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact
-
-
-
-
Method Detail
-
createClassForFD
public static JClass createClassForFD(java.lang.String arrayFD, JamClassLoader loader)
Creates an array JClass from a field descriptor as described in the JLS. This is the nasty '[[[Lfoo.bar.Baz;'-style notation.
-
normalizeArrayName
public static java.lang.String normalizeArrayName(java.lang.String declaration)
Returns the normal form for a given array name. This is a trimmed, unspaced field descriptor, e.g. '[[[Ljava.lang.String;' for a three dimensional array of strings. This method will also normalize understands declaration-style array names, e.g. 'java.lang.String[][][]'.
-
getSimpleName
public java.lang.String getSimpleName()
Description copied from interface:JElement
Returns a simple name of this abstraction. The exact format of the name depends on the particular abstraction (see javadoc). Please refer to the JAM package documentation for more details on naming conventions.
- Specified by:
getSimpleName
in interfaceJElement
- Overrides:
getSimpleName
in classElementImpl
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:JElement
Returns a qualified name for this abstraction. The exact format of this name depends on the particular abstraction. Please refer to the documentation for each JElement subclass for a detailed description of the qualified name formats.
- Specified by:
getQualifiedName
in interfaceJElement
- Overrides:
getQualifiedName
in classBuiltinClassImpl
-
isArrayType
public boolean isArrayType()
Description copied from interface:JClass
Returns true if this JClass represents an array type.
- Specified by:
isArrayType
in interfaceJClass
- Overrides:
isArrayType
in classBuiltinClassImpl
-
getArrayComponentType
public JClass getArrayComponentType()
Description copied from interface:JClass
Returns the Class representing the component type of an array. If this JClass does not represent an array class this method returns null.
Note that this method differs substantially from
java.lang.Class.getComponentType()
in the way it treats multidimensional arrays. Specifically, letfooArrayClass
be the class of an n dimensional array of classfoo
for n > 2. For the java.lang.Class representation offooArrayClass
,getComponentType()
will return a java.lang.Class for an (n-1)-dimensional array offoo
s. By contrast, the JClass representation offooArrayClass
will always simply return a JClass representingfoo
for any value of n > 1.In other words, this method always returns the 'core' type of the array, effectively hiding away all of the intermediary array types. Given that JClass provides the additional
getArrayDimensions
facility, it is felt that this is a much easier convention for tool authors to work with.- Specified by:
getArrayComponentType
in interfaceJClass
- Overrides:
getArrayComponentType
in classBuiltinClassImpl
-
getArrayDimensions
public int getArrayDimensions()
Description copied from interface:JClass
If this JClass represents an array type (isArray() == true), returns the number of dimensions in the array. Otherwise returns zero.
- Specified by:
getArrayDimensions
in interfaceJClass
- Overrides:
getArrayDimensions
in classBuiltinClassImpl
-
getSuperclass
public JClass getSuperclass()
Description copied from interface:JClass
Returns the Class representing the superclass of the entity (class, interface, primitive type or void) represented by this Class. If this Class represents either the Object class, an interface, a primitive type, or void, then null is returned. If this object represents an array class then the Class object representing the Object class is returned.
- Specified by:
getSuperclass
in interfaceJClass
- Overrides:
getSuperclass
in classBuiltinClassImpl
-
isAssignableFrom
public boolean isAssignableFrom(JClass c)
Description copied from interface:JClass
Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so; otherwise it returns false. If this Class object represents a primitive type, this method returns true if the specified Class parameter is exactly this Class object; otherwise it returns false.
Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class object via an identity conversion or via a widening reference conversion. See The Java Language Specification, sections 5.1.1 and 5.1.4 , for details.
-
getFieldDescriptor
public java.lang.String getFieldDescriptor()
Description copied from interface:JClass
Returns the name of this member in the format described in section 4.3.2 of the VM spec, 'Field Descriptors.' This is the same nasty format returned by java.lang.Class.getName(), and is the format you need to use in calls to Class.forName(). For example, the ClassfileName of the class of a two-dimensional array of strings is
[[Ljava.lang.String;
. For details, see http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html- Specified by:
getFieldDescriptor
in interfaceJClass
- Overrides:
getFieldDescriptor
in classBuiltinClassImpl
-
-