public final class ArrayClassImpl extends BuiltinClassImpl
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTY| Modifier and Type | Method and Description |
|---|---|
static JClass |
createClassForFD(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.
|
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().
|
String |
getQualifiedName()
Returns a qualified name for this abstraction.
|
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 String |
normalizeArrayName(String declaration)
Returns the normal form for a given array name.
|
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, setSuperclassUnqualifiedaddAnnotationForProxy, addLiteralAnnotation, createComment, findOrCreateAnnotation, getAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getComment, getEditableProxy, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeAnnotation, removeCommentcompareTo, createSourcePosition, defaultName, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, removeSourcePosition, setArtifact, toStringaddLiteralAnnotation, createComment, findOrCreateAnnotation, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeCommentcreateSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifactgetClassLoadergetAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getCommentgetArtifact, getParent, toStringpublic static JClass createClassForFD(String arrayFD, JamClassLoader loader)
public static String normalizeArrayName(String declaration)
public String getSimpleName()
JElementReturns 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.
getSimpleName in interface JElementgetSimpleName in class ElementImplpublic String getQualifiedName()
JElementReturns 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.
getQualifiedName in interface JElementgetQualifiedName in class BuiltinClassImplpublic boolean isArrayType()
JClassReturns true if this JClass represents an array type.
isArrayType in interface JClassisArrayType in class BuiltinClassImplpublic JClass getArrayComponentType()
JClassReturns 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, let
fooArrayClass be the class of an n dimensional array
of class foo for n > 2. For the java.lang.Class
representation of fooArrayClass,
getComponentType() will return a java.lang.Class for
an (n-1)-dimensional array of foos. By contrast,
the JClass representation of fooArrayClass will
always simply return a JClass representing foo 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.
getArrayComponentType in interface JClassgetArrayComponentType in class BuiltinClassImplpublic int getArrayDimensions()
JClassIf this JClass represents an array type (isArray() == true), returns the number of dimensions in the array. Otherwise returns zero.
getArrayDimensions in interface JClassgetArrayDimensions in class BuiltinClassImplpublic JClass getSuperclass()
JClassReturns 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.
getSuperclass in interface JClassgetSuperclass in class BuiltinClassImplpublic boolean isAssignableFrom(JClass c)
JClassDetermines 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.
public String getFieldDescriptor()
JClassReturns 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
getFieldDescriptor in interface JClassgetFieldDescriptor in class BuiltinClassImplCopyright © 2010 - 2020 Adobe. All Rights Reserved