|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JavaType
JavaType is the common base interface for JavaClass, JavaTypeVariable, and JavaWildcardType. All types may be asked for their superclass, array of interfaces, inheritance hierarchy, and array of members. Type variables and wildcard types (obviously) declare no members.
Field Summary | |
---|---|
static JavaType[] |
EMPTY_ARRAY |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o) |
int |
getArrayDimensions() |
JavaType |
getBaseComponentType() |
JavaClass |
getClass(java.lang.String name) Iteratively retrieves all member classes declared in this class or its hierarchy. |
java.util.Collection |
getClasses() Iteratively retrieves all member classes declared in this class or its hierarchy. |
JavaMethod |
getClinitMethod() |
JavaClass |
getClosestClass() Deprecated. Please use getTypeErasure() . |
JavaType |
getComponentType() |
JavaClass |
getDeclaredClass(java.lang.String name) |
java.util.Collection |
getDeclaredClasses() In order to get all inner classes, clients must recurse through direct inner classes. |
JavaMethod |
getDeclaredConstructor(JavaType[] parameters) |
java.util.Collection |
getDeclaredConstructors() |
JavaField |
getDeclaredField(java.lang.String name) |
java.util.Collection |
getDeclaredFields() |
JavaMethod |
getDeclaredMethod(java.lang.String name, JavaType[] parameters) |
java.util.Collection |
getDeclaredMethods() |
java.util.Collection |
getDeclaredMethods(java.lang.String name) |
java.lang.String |
getDescriptor() Gets the descriptor for this type, as defined by the JVMS2. |
JavaField |
getField(java.lang.String name) Iteratively searches for a field declared in this class or its hierarchy. |
java.util.Collection |
getFields() Iteratively retrieves all fields declared in this class and its hierarchy. |
java.util.Set |
getHierarchy() Recursively gets the full list of all resolved superclasses and super-interfaces. |
java.util.Collection |
getInterfaces() The name "getInterfaces" was chosen to be consistent with java/lang/Class. |
JavaMethod |
getMethod(java.lang.String name, JavaType[] parameters) Iteratively searches for a method declared in this class or its hierarchy. |
java.util.Collection |
getMethods() Iteratively retrieves all methods declared in this class or its hierarchy. |
java.util.Collection |
getMethods(java.lang.String name) Iteratively retrieves all methods declared in this class or its hierarchy. |
java.lang.String |
getName() Gets the simplest name of this type with "[]"s if present. |
JavaPackage |
getPackage() Gets the owning package, null if N/A. |
java.lang.String |
getPackageName() Gets the qualified name of the owning package. |
java.lang.String |
getQualifiedName() Gets the fully qualified name of this type in source format. |
java.lang.String |
getRawName() Gets the raw name of this type. |
java.lang.String |
getSignature() Gets the "Signature" attribute of this type, as defined by the JVMS3. |
JavaType |
getSuperclass() The name "getSuperclass" was chosen to be consistent with java/lang/Class. |
CompiledTmpVariable |
getThisValue() In the interest of minimizing the number of tmp variables floating around in the heap, each type may create a value object (when needed) and store it (with a weak reference) for later use. |
JavaClass |
getTypeErasure() Gets the type erasure of this type, as defined by the JLS3. |
java.lang.String |
getTypeSignature() Gets the type signature for this type, as defined by the JVMS3. |
java.lang.String |
getUniqueIdentifier() Gets a unique identifier for this type. |
java.lang.String |
getUnqualifiedName() Gets the name of this type in its unqualified form. |
java.util.Collection<UnresolvedType> |
getUnresolvedInterfaces() When reverse engineering byecode, some types cannot be resolved if the correct owning project is not associated to the JavaProvider. |
java.net.URL |
getURL() If the input for this type is a *.class file, the returned URL will be for the *.class file. |
java.lang.String |
getVMName() Gets the VM name for this type. |
boolean |
isAnnotation() |
boolean |
isArray() |
boolean |
isAssignableFrom(JavaType subject) Consider the following expression where S (subject) represents another type and T (this) represents this type. |
boolean |
isEnum() |
boolean |
isExported() |
boolean |
isInterface() |
boolean |
isMemberClass() True if this is a member type. |
boolean |
isPrimitive() |
boolean |
isSubtypeOf(JavaType supertype) True if this is a subtype of the indicated argument. |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaIsGeneric |
---|
getActualTypeArguments, getTypeParameter, getTypeParameters, hasActualTypeArguments, hasTypeParameters |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaMember |
---|
getOwningClass, isAbstract, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasType |
---|
getResolvedType, getUnresolvedType |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasAnnotations |
---|
getAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement |
---|
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo |
Field Detail |
---|
static final JavaType[] EMPTY_ARRAY
Method Detail |
---|
@Deprecated
JavaClass getClosestClass()
getTypeErasure()
.getTypeErasure()
. If this type is a ...
... JavaClass, then it is returned.
... JavaTypeVariable, then the first bound is returned. There is always at least one bound.
... JavaWildcardType, then the lower bound is returned. There is always at least one lower bound.
JavaClass getTypeErasure()
CompiledTmpVariable getThisValue()
EXPERIMENTAL.
boolean isPrimitive()
boolean isArray()
JavaType getComponentType()
int getArrayDimensions()
JavaType getBaseComponentType()
boolean isInterface()
boolean isEnum()
boolean isAnnotation()
boolean isExported()
boolean isMemberClass()
java.lang.String getName()
The name of a non-parametrized top-level type of the form "pkg.Cls" is "Cls".
The name of a non-parametrized member type of the form "pkg.Cls.InnerClass" is "InnerClass".
The name of an array type T[] is the name of T suffixed by the appropriate number of "[]"s.
The name of a parametrized type is the same as the name of its raw type. That is, the name of "pkg.Cls<String>" is simply "Cls".
The name of a wildcard type is always "?".
The name of a type parameter should be pretty obvious.
The name of a primitive type should be pretty obvious.
The name of a local inner class is just its name.
An anonymous inner classes does not have a name and will return the empty string.
getName
in interface JavaHasName
java.lang.String getUnqualifiedName()
Unlike getName(), this will contain type parameters in their unqualified form. In other words, for types containing no type parameterization, the behavior is the same as getName().
java.lang.String getQualifiedName()
The source name of a non-parametrized top-level type of the form "pkg.Cls" is "pkg.Cls".
The source name of a non-parametrized member type of the form T.InnerClass (that is, a member type InnerClass that is a member of type T) is the source name of T suffixed with by ".InnerClass", e.g. "java.util.Map.Entry", "pkg.Cls<?>.InnerClass".
The source name of a parametrized type starts with the source name of the raw type and lists the source name of all of its actual type argumenths, e.g. "java.util.List<java.lang.String>". The source name of an array type T[] is the source name of T suffixed by the appropriate number of "[]"s.
The source name of a wildcard type is the string with which it would appear in a source file. The three possible forms this can take are: "?", "? extends T", "? super T".
The source name of a type parameter is just its name.
The source name of a primitive type should be pretty obvious.
The source name of a local inner class is just its name because a local inner class is referenced, in a source file, by its name.
An anonymous inner classes does not have a source name. It will return the empty string for its source name.
Open for discussion: What should be returned by an anonymous class? Technically, the concept of a source name is irrelevant because anonymous classes may not be referred to in a source compilation unit.
java.lang.Object
java.util.Map<String,String>
java.lang.String[][]
java.lang.String getRawName()
The raw name of a parametrized top-level or member or local inner type is the source name of its type erasure, as defined by the JLS3. Think of the raw name as the source name with all parametrization stripped out.
The raw name of an array type T[] is the raw name of T suffixed by the appropriate number of "[]"s.
The raw name for any other type is the same as its source name.
java.lang.String getVMName()
The VM name of a non-parametrized top-level type of the form "pkg.Cls" is "pkg/Cls".
The VM name of a non-parametrized member-level type of the form "pkg.Cls.InnerClass" is "pkg/Cls$InnerClass".
The VM name of a parametrized type is the VM name of the raw type. Because parametrization is stripped at run-time, we will omit it from the VM name.
The VM name of an array type T[] is the VM name of T suffixed by the appropriate number of "[]"s.
The VM name of a local inner class or anonymous inner class is a string that uniquely identifies it from all other types and is usually prefixed with the VM name of its directly enclosing class. For example, an anonymous inner class belonging to the type "pkg.Cls" may return "pkg/Cls$1".
The VM name of any other type is the same as its source name.
java.lang.String getDescriptor()
For jdk < 1.5, the "FieldDescriptor" is returned (JVMS2). For jdk < 1.5, descriptors and signatures are the same thing.
For jdk >= 1.5, a type signature of the type erasure is returned.
Note: Do not confuse a type's descriptor with a method's descriptor. The descriptor of the type of a method is the field descriptor describing its return type. The descriptor of a method describes parameter types.
java.lang.String getTypeSignature()
A JavaClass returns its "ClassTypeSignature" (JVMS3). A JavaClass is uniquely identified by its type signature. Example value: Ljava/util/List<Ljava/lang/Object;>;
A JavaTypeVariable returns its "TypeVariableSignature" (JVMS3). A type variable is uniquely identified by the combination of its owning declaration AND its type signature. Example value: TE;
A WildcardType returns its "TypeArgument" value (JVMS3). A wildcard type is uniquely identified by its type signature. Example values: *
+Ljava/lang/Object;
.
java.lang.String getSignature()
The "Signature" attribute for a field is the "ClassTypeSignature" for its type.
The "Signature" attribute for a method involves the "ClassSignature"s for its type parameters and the "ClassTypeSignature"s of its remaining constituent types.
A JavaClass returns its "ClassSignature" (JVMS3).
A JavaTypeVariable does not have a class signature, but will return a string for use in a class signature or a method signature.
A WildcardType does not have a class signature and may not part of a class signature. Its return value is undefined.
java.lang.String getUniqueIdentifier()
getUniqueIdentifier
in interface JavaMember
JavaPackage getPackage()
java.lang.String getPackageName()
JavaType getSuperclass()
If this is a JavaClass: Null for java/lang/Object and primitive types, non-null otherwise. Where no base class was declared, java/lang/Object is returned, even for interfaces.
If this is a JavaType: Null if no superclass was declared AND an interface was declared.
If this is a JavaWildcardType: Always null.
java.util.Collection getInterfaces()
java.util.Collection<UnresolvedType> getUnresolvedInterfaces()
java.util.Set getHierarchy()
The full list of base classes and base interfaces does not have duplicates.
Here, the definition of "hierarchy" is the set of types that this type inherits members from. That is, "hierarchy" is defined by the "inherits from" relationship rather than from the "is a subtype of" relationship.
boolean isAssignableFrom(JavaType subject)
void method( S subject ) { T variable = subject; }Notice that because the parameter subject is not a constant-value, the assignment conversion will not perform the implicit narrowing conversion.
NOTE: At the current writing, isAssignableFrom does not perform auto-boxing.
boolean isSubtypeOf(JavaType supertype)
java.util.Collection getDeclaredFields()
JavaField getDeclaredField(java.lang.String name)
name
- Require non-null.java.util.Collection getDeclaredConstructors()
JavaMethod getDeclaredConstructor(JavaType[] parameters)
parameters
- Null indicates an empty parameter list.java.util.Collection getDeclaredMethods()
java.util.Collection getDeclaredMethods(java.lang.String name)
JavaMethod getDeclaredMethod(java.lang.String name, JavaType[] parameters)
parameters
- Null indicates an empty parameter list.java.util.Collection getDeclaredClasses()
JavaClass getDeclaredClass(java.lang.String name)
JavaMethod getClinitMethod()
java.util.Collection getFields()
The implicit length field for array types is not reflected by this method.
JavaField getField(java.lang.String name)
The implicit length field for array types is not reflected by this method.
name
- Require non-null.java.util.Collection getMethods()
java.util.Collection getMethods(java.lang.String name)
name
- Require non-null.JavaMethod getMethod(java.lang.String name, JavaType[] parameters)
name
- Require non-null.parameters
- Null indicates an empty parameter list.java.util.Collection getClasses()
JavaClass getClass(java.lang.String name)
Note: Be careful not to get this confused with JavaProvider.getClass( String ).
java.net.URL getURL()
boolean equals(java.lang.Object o)
equals
in class java.lang.Object
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |