Interface ArrayType
- All Superinterfaces:
Accessible, Comparable<ReferenceType>, Mirror, ReferenceType, Type
Provides access to the class of an array and the type of
its components in the target VM.
- Since:
- 1.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets the JNI signature of the components of this array class.Returns the component type of this array, as specified in the array declaration.Returns a text representation of the component type of this array.newInstance(int length) Creates a new instance of this array class in the target VM.Methods declared in interface Accessible
isPackagePrivate, isPrivate, isProtected, isPublic, modifiersModifier and TypeMethodDescriptionbooleanDetermines if this object mirrors a package private item.booleanDetermines if this object mirrors a private item.booleanDetermines if this object mirrors a protected item.booleanisPublic()Determines if this object mirrors a public item.intReturns the Java programming language modifiers, encoded in an integer.Methods declared in interface Comparable
compareToModifier and TypeMethodDescriptionintCompares this object with the specified object for order.Methods declared in interface Mirror
toString, virtualMachineModifier and TypeMethodDescriptiontoString()Returns a String describing this mirrorGets the VirtualMachine to which this Mirror belongs.Methods declared in interface ReferenceType
allFields, allLineLocations, allLineLocations, allMethods, availableStrata, classLoader, classObject, constantPool, constantPoolCount, defaultStratum, equals, failedToInitialize, fieldByName, fields, genericSignature, getValue, getValues, hashCode, instances, isAbstract, isFinal, isInitialized, isPrepared, isStatic, isVerified, locationsOfLine, locationsOfLine, majorVersion, methods, methodsByName, methodsByName, minorVersion, module, name, nestedTypes, sourceDebugExtension, sourceName, sourceNames, sourcePaths, visibleFields, visibleMethodsModifier and TypeMethodDescriptionReturns a list containing eachFielddeclared in this type, and its superclasses, implemented interfaces, and/or superinterfaces.Returns a list containing aLocationobject for each executable source line in this reference type.allLineLocations(String stratum, String sourceName) Returns a list containing aLocationobject for each executable source line in this reference type.Returns a list containing eachMethoddeclared in this type, and its superclasses, implemented interfaces, and/or superinterfaces.Return the available strata for this reference type.Gets the classloader object which loaded the class corresponding to this type.Returns the class object that corresponds to this type in the target VM.byte[]Returns the raw bytes of the constant pool in the format of the constant_pool item of the Class File Format in the Java Virtual Machine Specification.intReturns the number of entries in the constant pool plus one.Returns the default stratum for this reference type.booleanCompares the specified Object with this ReferenceType for equality.booleanDetermines if initialization failed for this class.fieldByName(String fieldName) Finds the visibleFieldwith the given non-ambiguous name.fields()Returns a list containing eachFielddeclared in this type.Gets the generic signature for this type if there is one.inthashCode()Returns the hash code value for this ObjectReference.instances(long maxInstances) Returns instances of this ReferenceType.booleanDetermines if this type was declared abstract.booleanisFinal()Determines if this type was declared final.booleanDetermines if this type has been initialized.booleanDetermines if this type has been prepared.booleanisStatic()Determines if this type was declared static.booleanDetermines if this type has been verified.locationsOfLine(int lineNumber) Returns a List containing allLocationobjects that map to the given line number.locationsOfLine(String stratum, String sourceName, int lineNumber) Returns a List containing allLocationobjects that map to the given line number.intReturns the class major version number, as defined in the class file format of the Java Virtual Machine Specification.methods()Returns a list containing eachMethoddeclared directly in this type.methodsByName(String name) Returns a List containing each visibleMethodthat has the given name.methodsByName(String name, String signature) Returns a List containing each visibleMethodthat has the given name and signature.intReturns the class minor version number, as defined in the class file format of the Java Virtual Machine Specification.default ModuleReferencemodule()Gets the module object which contains the class corresponding to this type.name()Returns the name of thisReferenceTypeobject.Returns a List containingReferenceTypeobjects that are declared within this type and are currently loaded into the Virtual Machine.Get the source debug extension of this type.Gets an identifying name for the source corresponding to the declaration of this type.sourceNames(String stratum) Gets the identifying names for all the source corresponding to the declaration of this type.sourcePaths(String stratum) Gets the paths to the source corresponding to the declaration of this type.Returns a list containing each unhidden and unambiguousFieldin this type.Returns a list containing eachMethoddeclared or inherited by this type.
-
Method Details
-
newInstance
Creates a new instance of this array class in the target VM. The array is created with the given length and each component is initialized to is standard default value.- Parameters:
length- the number of components in the new array- Returns:
- the newly created
ArrayReferencemirroring the new object in the target VM. - Throws:
VMCannotBeModifiedException- if the VirtualMachine is read-only - seeVirtualMachine.canBeModified().
-
componentSignature
String componentSignature()Gets the JNI signature of the components of this array class. The signature describes the declared type of the components. If the components are objects, their actual type in a particular run-time context may be a subclass of the declared class.- Returns:
- a string containing the JNI signature of array components.
-
componentTypeName
String componentTypeName()Returns a text representation of the component type of this array.- Returns:
- a text representation of the component type.
-
componentType
Returns the component type of this array, as specified in the array declaration.Note: The component type of a array will always be created or loaded before the array - see The Java Virtual Machine Specification, section 5.3.3 - Creating Array Classes. However, although the component type will be loaded it may not yet be prepared, in which case the type will be returned but attempts to perform some operations on the returned type (e.g.
fields()) will throw aClassNotPreparedException. UseReferenceType.isPrepared()to determine if a reference type is prepared.- Returns:
- the
Typeof this array's components. - Throws:
ClassNotLoadedException- See Also:
-