package bluej.debugger.gentype;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;


| A "reflective" is an object representing a java type. This interface |* provides methods to, for instance, find the superclass/superinterfaces, * determine the generic type parameters, etc. * * @author Davin McCall public abstract class Reflective {
| Get the name of the class or interface represented by the reflective. | The name is such that it can be passed to ClassLoader's loadClass | method. | | @return The fully qualified class/interface name. | public abstract String getName();
| Get the name of the class or interface represented by the reflective. | The name is in a form that can be presented nicely to the user. | public String getSimpleName() { return getName(); }
| Get the formal type parameters of the class/interface this reflective | represents. Note that this does not give the type parameters from | outer classes which may still parameterize this reflective's class. | | @return The parameters as a List of GenTypeDeclTpar | public abstract List getTypeParams();
| Get the (direct) supertypes of this reflective, as a list of reflectives. | Supertypes of an array include the "Object" class as well as arrays whose |* component type is a supertype of this array's component type. * @return A List of Reflectives */ public abstract List<Reflective> getSuperTypesR(); | |/** | Get the supertypes of this reflective, as a list of GenTypes. The type | parameter names will refer to the type parameters in the parent type. | @return A List of GenTypeClass. | public abstract List getSuperTypes();
| Get a reflective which represents an array, whose element type is | represented by this reflective. | | @return A reflective representing an array | public abstract Reflective getArrayOf();
| Return true if a variable of the reference type reflected by this | reflective can be assigned a value of the type represented by the given | reflective. | | @param r The other reflective | @return True if the other reflective type is assignable to this type | public abstract boolean isAssignableFrom(Reflective r);
| Return true if this reflective represents an interface type rather than | a class type. | @return True if this reflective represents an interface | public abstract boolean isInterface();
| Get a supertype (as a GenTypeClass) by name. The default implementation | uses getSuperTypes() and searches the resulting list. | | @param rawName the name of the supertype to find | @return the supertype as a GenTypeClass | public GenTypeClass superTypeByName(String rawName) { List<GenTypeClass> superTypes = getSuperTypes(); Iterator<GenTypeClass> i = superTypes.iterator(); while ( i.hasNext() ) { GenTypeClass next = i.next(); if ( next.classloaderName().equals(rawName) ) return next; } return null; }
| Find another class as if it were to be loaded by this one. Ie. use this | class's classloader. | | @param name The name of the class to locate | abstract public Reflective getRelativeClass(String name);
| Get the outer class of this one, if there is one. | public Reflective getOuterClass() { int dollarIndex = getName().lastIndexOf('$'); if (dollarIndex != -1) { int dotIndex = getName().indexOf('.', dollarIndex); if (dotIndex == -1) { String outerName = getName().substring(0, dollarIndex); return getRelativeClass(outerName); } } return null; }
| Determine whether this class is a static inner class. | abstract public boolean isStatic();
| Determine whether this class is declared public. | abstract public boolean isPublic();
| Determine whether this class is declared final. | abstract public boolean isFinal();
| Get the methods declared in the type represented by this Reflective. | This does not include methods declared in the superclass(es), nor does | it include synthetic methods. | | @return a map which maps method names to a set of methods | (represented by MethodReflective objects) | abstract public Map> getDeclaredMethods();
| Gets the constructors declared in the type represented by this Reflective. | abstract public List getDeclaredConstructors();
| Get the fields declared in the type represented by this Reflective. | This does not include fields declared in the superclass(es). | abstract public Map getDeclaredFields();
| Get a reference to a named inner class of this class. Returns null If | the named inner class doesn't exist. | abstract public Reflective getInnerClass(String name);
| Get the module name of this type. Returns null if not known or non-applicable. | abstract public String getModuleName(); }
top, use, map, abstract class Reflective

.   getName
.   getSimpleName
.   getTypeParams
.   getSuperTypes
.   getArrayOf
.   isAssignableFrom
.   isInterface
.   superTypeByName
.   getRelativeClass
.   getOuterClass
.   isStatic
.   isPublic
.   isFinal
.   getDeclaredMethods
.   getDeclaredConstructors
.   getDeclaredFields
.   getInnerClass
.   getModuleName




128 neLoCode + 50 LoComm