| java.lang.Object com.google.gwt.core.ext.typeinfo.TypeOracle
TypeOracle | public class TypeOracle (Code) | | Provides type-related information about a set of source files, including doc
comment metadata.
All type objects exposed, such as
com.google.gwt.core.ext.typeinfo.JClassType and others, have a stable
identity relative to this type oracle instance. Consequently, you can
reliably compare object identity of any objects this type oracle produces.
For example, the following code relies on this stable identity guarantee:
JClassType o = typeOracle.getJavaLangObject();
JClassType s1 = typeOracle.getType("java.lang.String");
JClassType s2 = typeOracle.getType("java.lang.String");
assert(s1 == s2);
assert(o == s1.getSuperclass());
JParameterizedType ls = typeOracle.parse("java.util.List<java.lang.String>");
assert(ls.getTypeArgs()[0] == s1);
|
MOD_ABSTRACT | final static int MOD_ABSTRACT(Code) | | |
MOD_FINAL | final static int MOD_FINAL(Code) | | |
MOD_NATIVE | final static int MOD_NATIVE(Code) | | |
MOD_PRIVATE | final static int MOD_PRIVATE(Code) | | |
MOD_PROTECTED | final static int MOD_PROTECTED(Code) | | |
MOD_PUBLIC | final static int MOD_PUBLIC(Code) | | |
MOD_STATIC | final static int MOD_STATIC(Code) | | |
MOD_TRANSIENT | final static int MOD_TRANSIENT(Code) | | |
MOD_VOLATILE | final static int MOD_VOLATILE(Code) | | |
NO_STRING_ARR_ARR | final static String[][] NO_STRING_ARR_ARR(Code) | | |
TAG_TYPEARGS | final public static String TAG_TYPEARGS(Code) | | A reserved metadata tag to indicates that a field type, method return type
or method parameter type is intended to be parameterized. Note that
constructor type parameters are not supported at present.
|
TypeOracle | public TypeOracle()(Code) | | |
findPackage | public JPackage findPackage(String pkgName)(Code) | | Attempts to find a package by name. All requests for the same package
return the same package object.
null if the package could not be found |
findType | public JClassType findType(String name)(Code) | | Finds a class or interface given its fully-qualified name. For nested
classes, use its source name rather than its binary name (that is, use a
"." rather than a "$").
null if the type is not found |
findType | public JClassType findType(String pkgName, String typeName)(Code) | | Finds a type given its package-relative name. For nested classes, use its
source name rather than its binary name (that is, use a "." rather than a
"$").
null if the type is not found |
getArrayType | public JArrayType getArrayType(JType componentType)(Code) | | Gets the type object that represents an array of the specified type. The
returned type always has a stable identity so as to guarantee that all
calls to this method with the same argument return the same object.
Parameters: componentType - the component type of the array, which can itself bean array type a type object representing an array of the component type |
getJavaLangObject | public JClassType getJavaLangObject()(Code) | | Gets a reference to the type object representing
java.lang.Object .
|
getOrCreatePackage | public JPackage getOrCreatePackage(String name)(Code) | | Ensure that a package with the specified name exists as well as its parent
packages.
|
getPackage | public JPackage getPackage(String pkgName) throws NotFoundException(Code) | | Gets a package by name. All requests for the same package return the same
package object.
the package object associated with the specified name |
getPackages | public JPackage[] getPackages()(Code) | | Gets an array of all packages known to this type oracle.
an array of packages, possibly of zero-length |
getParameterizedType | public JParameterizedType getParameterizedType(JGenericType genericType, JClassType enclosingType, JClassType[] typeArgs)(Code) | | Gets the parameterized type object that represents the combination of a
specified raw type and a set of type arguments. The returned type always
has a stable identity so as to guarantee that all calls to this method with
the same arguments return the same object.
Parameters: genericType - a generic base class Parameters: enclosingType - Parameters: typeArgs - the type arguments bound to the specified generic type a type object representing this particular binding of typearguments to the specified generic throws: IllegalArgumentException - if the parameterization of a non-staticmember type does not specify an enclosing type or if not enougharguments were specified to parameterize the generic type throws: NullPointerException - if genericType is null |
getParameterizedType | public JParameterizedType getParameterizedType(JGenericType genericType, JClassType[] typeArgs)(Code) | | Gets the parameterized type object that represents the combination of a
specified raw type and a set of type arguments. The returned type always
has a stable identity so as to guarantee that all calls to this method with
the same arguments return the same object.
Parameters: genericType - a generic base class Parameters: typeArgs - the type arguments bound to the specified generic type a type object representing this particular binding of typearguments to the specified generic throws: IllegalArgumentException - if the generic type is a non-static membertype or if not enough arguments were specified to parameterizethe generic type throws: NullPointerException - if genericType is null |
getReloadCount | public long getReloadCount()(Code) | | |
getType | public JClassType getType(String name) throws NotFoundException(Code) | | Finds a type given its fully qualified name. For nested classes, use its
source name rather than its binary name (that is, use a "." rather than a
"$").
the specified type |
getType | public JClassType getType(String pkgName, String topLevelTypeSimpleName) throws NotFoundException(Code) | | Finds a type given its package-relative name. For nested classes, use its
source name rather than its binary name (that is, use a "." rather than a
"$").
the specified type |
getTypes | public JClassType[] getTypes()(Code) | | Gets all types, both top-level and nested.
an array of types, possibly of zero length |
incrementReloadCount | void incrementReloadCount()(Code) | | |
invalidateTypesInCompilationUnit | void invalidateTypesInCompilationUnit(CompilationUnitProvider cup)(Code) | | Note, this method is called reflectively from the
CacheManager.invalidateOnRefresh(TypeOracle) .
Parameters: cup - compilation unit whose types will be invalidated |
modifierBitsToNames | static String[] modifierBitsToNames(int bits)(Code) | | |
parse | public JType parse(String type) throws TypeOracleException(Code) | | Parses the string form of a type to produce the corresponding type object.
The types that can be parsed include primitives, class and interface names,
simple parameterized types (those without wildcards or bounds), and arrays
of the preceding.
Examples of types that can be parsed by this method.
int
java.lang.Object
java.lang.String[]
char[][]
void
List<Shape>
List<List<Shape>>
Parameters: type - a type signature to be parsed the type object corresponding to the parse type |
refresh | void refresh(TreeLogger logger) throws NotFoundException(Code) | | Updates relationships within this type oracle. Should be called after any
changes are made.
Throws TypeOracleException thrown if fundamental baseline
correctness criteria are violated, most notably the absence of
"java.lang.Object"
|
sort | public void sort(JClassType[] types)(Code) | | Convenience method to sort class types in a consistent way. Note that the
order is subject to change and is intended to generate an "aesthetically
pleasing" order rather than a computationally reliable order.
|
sort | public void sort(JConstructor[] ctors)(Code) | | Convenience method to sort constructors in a consistent way. Note that the
order is subject to change and is intended to generate an "aesthetically
pleasing" order rather than a computationally reliable order.
|
sort | public void sort(JField[] fields)(Code) | | Convenience method to sort fields in a consistent way. Note that the order
is subject to change and is intended to generate an "aesthetically
pleasing" order rather than a computationally reliable order.
|
sort | public void sort(JMethod[] methods)(Code) | | Convenience method to sort methods in a consistent way. Note that the order
is subject to change and is intended to generate an "aesthetically
pleasing" order rather than a computationally reliable order.
|
|
|