|
|||||||||
| Home >> All >> javax >> ide >> model >> java >> [ declaration overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.ide.model.java.declaration
Interface TypeD

- All Superinterfaces:
- Declaration, HasTypeD
- All Known Subinterfaces:
- ArrayTypeD, ClassD, TypeVariableD, WildcardTypeD
- public interface TypeD
- extends Declaration, HasTypeD
Mirrors a type.
Members
A member should be listed in its respective member collection if it is either declared or inherited. Members that are not inherited should not be listed. Private members are never inherited. Package-private members are not inherited outside of the declaring package. Public members are always inherited. Note that constructors are never inherited. The order of the member listing should be determined by the type hierarchy. If type B occurs before type A in the type hierarchy, then all of B's declared members should occur before any of A's declared members in the member collection. Consider the following two classes.
class A
{
int a;
}
class B extends A
{
int b;
}
The iterator for the collection returned for the member fields of B
should always return B.b before A.a.
Order within the same declaring type is not defined.
TODO: If a client wanted to write a compiler and base it on the
declaration interfaces (which should conceivably be possible), how does
the client find out about not-inherited fields in order to display
a meaningful error message? Should we address that here?
| Nested Class Summary |
| Nested classes inherited from class javax.ide.model.java.declaration.Declaration |
Declaration.DeclarationKind |
| Field Summary | |
static TypeD[] |
EMPTY_ARRAY
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
True if the other object is also a TypeM and declarations the same type. |
ClassD |
getClass(java.lang.String name)
Gets the first matching member class, null if none. |
java.util.Collection |
getClasses()
Gets all member classes, declared and inherited. |
ClassD |
getDeclaredClass(java.lang.String name)
Gets the matching member class, null if none. |
java.util.Collection |
getDeclaredClasses()
Gets all declared member classes. |
MethodD |
getDeclaredConstructor(TypeD[] parameters)
Gets the matching declared constructor, null if none. |
java.util.Collection |
getDeclaredConstructors()
Gets all declared constructors. |
FieldD |
getDeclaredField(java.lang.String name)
Gets the first matching declared field, null if none. |
java.util.Collection |
getDeclaredFields()
Gets all declared fields. |
MethodD |
getDeclaredMethod(java.lang.String name,
TypeD[] parameters)
Gets the matching declared method, null if none. |
java.util.Collection |
getDeclaredMethods()
Gets all declared methods. |
java.util.Collection |
getDeclaredMethods(java.lang.String name)
Gets all matching declared methods. |
java.lang.String |
getDescriptor()
Gets the descriptor for this type, as defined by the JVMS2. |
FieldD |
getField(java.lang.String name)
Gets the matching member field, null if none. |
java.util.Collection |
getFields()
Gets all member fields, declared and inherited. |
java.util.Collection |
getHierarchy()
Recursively gets all superclasses and super-interfaces. |
java.util.Collection |
getInterfaces()
Gets this type's super-interfaces. |
MethodD |
getMethod(java.lang.String name,
TypeD[] parameters)
Gets the first matching method, null if none. |
java.util.Collection |
getMethods()
Gets all member methods, declared and inherited. |
java.util.Collection |
getMethods(java.lang.String name)
Gets all matching methods. |
java.lang.String |
getSourceName()
Gets the fully qualified name of this type in source format. |
TypeD |
getSuperclass()
Gets this type's superclass. |
TypeD |
getType()
Gets itself as its type. |
ClassD |
getTypeErasure()
Gets the type erasure of this type. |
java.lang.String |
getTypeSignature()
Gets the type signature for this type, as defined by the JVMS3. |
boolean |
isAnnotation()
True if this is an annotation type. |
boolean |
isArray()
True if this is an array type. |
boolean |
isAssignableFrom(TypeD subject)
True if this type is assignable from the subject type. |
boolean |
isEnum()
True if this is an enum type. |
boolean |
isInterface()
True if this is an interface. |
boolean |
isPrimitive()
True if this is a primitive type, including the special void type. |
| Methods inherited from interface javax.ide.model.java.declaration.Declaration |
getDeclarationKind, getPosition, isSynthetic |
| Field Detail |
EMPTY_ARRAY
public static final TypeD[] EMPTY_ARRAY
| Method Detail |
getType
public TypeD getType()
getTypeErasure
public ClassD getTypeErasure()
- Gets the type erasure of this type.
isPrimitive
public boolean isPrimitive()
- True if this is a primitive type, including the special
voidtype.
isArray
public boolean isArray()
- True if this is an array type.
isEnum
public boolean isEnum()
- True if this is an enum type.
isAnnotation
public boolean isAnnotation()
- True if this is an annotation type.
isInterface
public boolean isInterface()
- True if this is an interface. This includes "interface" types and
"annotation" types.
getSourceName
public java.lang.String getSourceName()
- Gets the fully qualified name of this type in source format.
Here, "source format" means the format of a type reference in a
source compilation unit. A type's source name uniquely identifies
a type in a specific scope but not in the general scope.
An array type returns the fully qualified name of its component
type suffixed by the appropriate number of brackets. Parametrized
types return the fully qualified name of its raw type suffixed
with the type parameters. A local inner class returns only its
simple name because that is how it is referred to in a source
compilation unit.
Note: Anonymous inner classes return the empty string because
they may not be referred to in a source compilation unit.
TODO: What should be returned by an anonymous class? Technically,
getSourceName() is irrelevant because anonymous classes may not
be referred to in a source compilation unit.
getDescriptor
public java.lang.String getDescriptor()
- Gets the descriptor for this type, as defined by the JVMS2.
For jdk < 1.5, the "FieldDescriptor" is returned (JVMS2). For
jdk >= 1.5, a type signature of the type erasure is returned.
Note: The descriptor is equivalent to the type signature of this
type's erasure.
getTypeSignature
public java.lang.String getTypeSignature()
- Gets the type signature for this type, as defined by the
JVMS3.
A ClassD returns its "ClassTypeSignature" (JVMS3). A ClassD is
uniquely identified by its type signature. Example value:
Ljava/util/ListA TypeVariableD returns its "TypeVariableSignature" (JVMS3). A TypeVariableD is uniquely identified by its owning declaration and its type signature. Example value:; TE;. A WildcardTypeD returns its "TypeArgument" value (JVMS3). A WildcardTypeD is uniquely identified by its type signature. Example values:*+Ljava/lang/Object;
getSuperclass
public TypeD getSuperclass()
- Gets this type's superclass. The name "getSuperclass" was chosen
to be consistent with java/lang/Class.
getInterfaces
public java.util.Collection getInterfaces()
- Gets this type's super-interfaces. The name "getInterfaces" was
chosen to be consistent with java/lang/Class.
getHierarchy
public java.util.Collection getHierarchy()
- Recursively gets all superclasses and super-interfaces. Order is
depth-first, classes before interfaces, left-to-right, no
duplicates.
isAssignableFrom
public boolean isAssignableFrom(TypeD subject)
- True if this type is assignable from the subject type. Behavior
should declaration reflection. Consider the following expression where
S (subject) represents another type and T (this) represents this
type.
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. TODO: Should isAssignableFrom perform auto-boxing? What does reflection do?
getDeclaredFields
public java.util.Collection getDeclaredFields()
- Gets all declared fields. Includes synthetic fields and enum
constants.
getDeclaredField
public FieldD getDeclaredField(java.lang.String name)
- Gets the first matching declared field, null if none.
getDeclaredConstructors
public java.util.Collection getDeclaredConstructors()
- Gets all declared constructors. Includes synthetic
constructors.
Note: Constructors are not inherited, so the collection of
declared constructors is the same as the collection of
constructors.
getDeclaredConstructor
public MethodD getDeclaredConstructor(TypeD[] parameters)
- Gets the matching declared constructor, null if none.
getDeclaredMethods
public java.util.Collection getDeclaredMethods()
- Gets all declared methods. Does not include the hidden
clinitmethod.
getDeclaredMethods
public java.util.Collection getDeclaredMethods(java.lang.String name)
- Gets all matching declared methods.
getDeclaredMethod
public MethodD getDeclaredMethod(java.lang.String name, TypeD[] parameters)
- Gets the matching declared method, null if none.
getDeclaredClasses
public java.util.Collection getDeclaredClasses()
- Gets all declared member classes. Does not include local and
anonymous inner classes.
TODO: Should this return local and anonymous inner classes? I
don't remember what reflection does.
getDeclaredClass
public ClassD getDeclaredClass(java.lang.String name)
- Gets the matching member class, null if none.
getFields
public java.util.Collection getFields()
- Gets all member fields, declared and inherited. The type
hierarchy dictates order.
For more detal on members, please see the Members discussion at
TypeD.
Note: The implicit "length" field for array types should be
suppressed because according to the JLS, it is technically not a
member variable.
TODO: Should this list shadowed (hidden) fields? Technically,
though they aren't visible, they are inherited.
getField
public FieldD getField(java.lang.String name)
- Gets the matching member field, null if none.
getMethods
public java.util.Collection getMethods()
- Gets all member methods, declared and inherited. The type
hierarchy dictates order.
For more detal on members, please see the Members discussion at
TypeD.
TODO: Should overridden methods be listed? They are neither
visible to the type's client nor are they inherited.
TODO: If a client wanted to write a compiler and base it on the
declaration interfaces (which should conceivably be possible), how
does the client find out about not-inherited methods in order to
display a meaningful error message? Should we address that here?
getMethods
public java.util.Collection getMethods(java.lang.String name)
- Gets all matching methods.
getMethod
public MethodD getMethod(java.lang.String name, TypeD[] parameters)
- Gets the first matching method, null if none.
getClasses
public java.util.Collection getClasses()
- Gets all member classes, declared and inherited. The type
hierarchy dictates order.
For more detal on members, please see the Members discussion at
TypeD.
TODO: Should this list shadowed (hidden) member classes?
Technically, though they aren't visible, they are inherited.
getClass
public ClassD getClass(java.lang.String name)
- Gets the first matching member class, null if none.
equals
public boolean equals(java.lang.Object o)
- True if the other object is also a TypeM and declarations the same
type.
ClassDs and WildcardTypeDs are uniquely identified by their type
signatures. TypeVariableDs are uniquely identified by both their
owning declaration and type signature.
|
|||||||||
| Home >> All >> javax >> ide >> model >> java >> [ declaration overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC