Class com.symantec.itools.vcafe.openapi.dtreflect.DTClass
All Packages Class Hierarchy This Package Previous Next Index
Class com.symantec.itools.vcafe.openapi.dtreflect.DTClass
Object
|
+----com.symantec.itools.vcafe.openapi.dtreflect.DTClass
- public class DTClass
- extends Object
- implements Serializable
DTClass is the root class for the dtreflect API for Design Time Reflection.
Design Time Reflection provides services analogous to the Java
reflection API, based upon parse information gathered
by Visual Cafe. Thus, classes reflected upon need not be compiled
or in a compilable state.
There are several significant differences between the dtreflect and
reflect packages:
dtreflect usually does not throw an exception when a
class, method, field, etc. cannot be found. Instead, the API uniformly
returns null, allowing simpler caller code. The nonNull()
methods allow callers to quickly and conveniently convert null
returns to NullPointerException if this is desired.
The DTListener interface combined with the notify()/notifyAll()
methods allows a dtreflect user to listen to specific/all classes
for changes. The validate() method of a dtreflect object verifies
that the information in the object is up-to-date. validate() should
also be called when a dtreflect object is serialized in, as the underlying
class, method, etc. may no longer exist or may have changed.
To avoid confusion, the forName() method is renamed findClass().
Since classes may be unique to projects and different classes
with the same name may exist in different projects, findClass() requires a
Project argument. The findSystemClass() method returns information
about classes that are common to all open projects.
dtreflect objects obtain their information from a parser for project files
and from compiled code for files outside the project. Because a parser
is more forgiving than the compiler, some information may be incomplete
or innacurate. In particular, variable, method return and argument types may
not be fully qualified. Each object has a validate interface that verifies
that all types used by the object could be used to create valid DTClass objects.
-
AnyType
-
-
BooleanType
-
-
ByteType
-
-
CharacterType
-
-
DoubleType
-
-
FloatType
-
-
IntegerType
-
-
LongType
-
-
NullType
-
-
ShortType
-
-
VoidType
-
-
cacheFlushDelay
-
-
com.symantec.itools.vcafe.openapi.dtreflect.DTClass(DTClass, int)
- Constructor used locally for primitive array types (boolean[], char[], etc).
-
com.symantec.itools.vcafe.openapi.dtreflect.DTClass(VisualProject, String, Class, int, boolean, boolean)
- Constructor used locally to make a DTClass, usually from a system java.lang.Class
-
com.symantec.itools.vcafe.openapi.dtreflect.DTClass()
-
-
classnameToString(String)
-
-
componentName(String)
-
-
equals(Object)
- Return true if the other class is the same as this.
-
equals(DTClass)
- Return true if the other class is the same as this.
-
findClass(VisualProject, String)
- Returns the
DTClass
object associated with the class
with the given string name.
-
findSystemClass(String)
- Returns the
DTClass
object associated with the class
with the given string name.
-
getAccessibleFields(DTClass, boolean)
- Returns an array of DTField objects reflecting all the fields
in the class or interface represented by this DTClass object that
can be seen by accessibleBy.
-
getAccessibleMethods(DTClass, boolean)
- Returns an array of DTMethod objects reflecting all the methods
in the class or interface represented by this DTClass object that
can be seen by accessibleBy.
-
getBounds()
- Return an array with the bounds of each array dimension
for the current class.The length of the returned int array
is equal to the number of dimensions of the class.
-
getClasses()
- Returns an array containing DTClass objects representing all the
public classes and interfaces that are members of the class
represented by this DTClass object.
-
getClassname(String, int)
- Derive a java class name, given a name in our internal format.
-
getClosestMember(int)
- Gets the closest member to the location.
-
getComponentName()
- If this class represents an array type, returns the name
of the component type; otherwise
returns the class name.
-
getComponentType()
- If this class represents an array type, returns the DTClass
object representing the component type of the array; otherwise
returns null.
-
getConstructor(DTClass[])
- Returns a DTConstructor object that reflects the specified public
constructor of the class represented by this DTClass object.
-
getConstructor(String[])
- Returns a DTConstructor object that reflects the specified public
constructor of the class represented by this DTClass object.
-
getConstructors()
- Returns an array containing DTConstructor objects reflecting
all the public constructors of the class represented by this
DTClass object.
-
getDeclaredClasses()
- Returns an array of DTClass objects reflecting all the classes
and interfaces declared as members of the class represented by
this DTClass object.
-
getDeclaredConstructor(DTClass[])
- Returns a DTConstructor object that reflects the specified declared
constructor of the class or interface represented by this DTClass
object.
-
getDeclaredConstructor(String[])
- Returns a DTConstructor object that reflects the specified declared
constructor of the class or interface represented by this DTClass
object.
-
getDeclaredConstructors()
- Returns an array of DTConstructor objects reflecting all the
constructors declared by the class represented by this DTClass
object.
-
getDeclaredField(String)
- Returns a DTField object that reflects the specified declared
field of the class or interface represented by this DTClass
object.
-
getDeclaredFields()
- Returns an array of DTField objects reflecting all the fields
declared by the class or interface represented by this DTClass
object.
-
getDeclaredMethod(String, DTClass[])
- Returns a DTMethod object that reflects the specified declared
method of the class or interface represented by this DTClass
object.
-
getDeclaredMethod(String, String[])
- Returns a DTMethod object that reflects the specified declared
method of the class or interface represented by this DTClass
object.
-
getDeclaredMethods()
- Returns an array of DTMethod objects reflecting all the methods
declared by the class or interface represented by this DTClass
object.
-
getDeclaringClass()
- If the class or interface represented by this DTClass object is
a member of another class, returns the DTClass object
representing the class of which it is a member (its
declaring class).
-
getDimensions()
- If this DTClass object represents an array type, returns the number of array dimensions,
otherwise returns false.
-
getField(String)
- Returns a DTField object that reflects the specified public
member field of the class or interface represented by
this DTClass object.
-
getFields()
- Returns an array containing DTField objects reflecting all the
accessible public fields of the class or interface represented
by this DTClass object.
-
getInterfaces()
- Determines the interfaces implemented by the class or interface
represented by this object.
-
getJavadocRange()
- gets the text range from the beginning of the first line of the class' Javadoc comment
to the closing asterisk-slash characters
-
getMethod(String, DTClass[])
- Returns a DTMethod object that reflects the specified public
member method of the class or interface represented by this
DTClass object.
-
getMethod(String, String[])
- Returns a DTMethod object that reflects the specified public
member method of the class or interface represented by this
DTClass object.
-
getMethods()
- Returns an array containing DTMethod objects reflecting all the
public member methods of the class or interface
represented by this DTClass object, including those declared by
the class or interface and and those inherited from
superclasses and superinterfaces.
-
getModifiers()
- Returns the Java language modifiers for this class or
interface, encoded in an integer.
-
getName()
- Returns the fully-qualified name of the type (class, interface,
array, or primitive) represented by this DTClass object, as a String.
-
getPackageName()
- Returns the package of the type (class, interface, array, or primitive) represented
by this DTClass object as a String, or null if the class isn't in a package
-
getPrimitiveClass(String)
- Return a DTClass object for the named primitive type.
-
getProject()
- Return the VisualProject that defines the class, or null for a system class.
-
getProjectFile()
- Return the ProjectFile that defines the class, or null for a system class.
-
getProjectFileID()
- Return the ID of the ProjectFile that defines the class, or 0 for a system class.
-
getProjectLoader()
- Return classloader for this class (project's classloader).
-
getSourceFile()
- Return the SourceFile that contains the class, or null if not found.
-
getSourceRange()
- gets the text range from the beginning of the "class" statement to the closing brace
-
getSuperclass()
- If this object represents any class other than the class
Object, then the object that represents the superclass
of that class is returned.
-
getUnqualifiedName()
- Returns the unqualified name (package is excluded) of the type (class, interface,
array, or primitive) represented by this DTClass object, as a String.
-
isArray()
- If this DTClass object represents an array type, returns true,
otherwise returns false.
-
isAssignable(DTClass)
- Determines if a value of a specified type can be assigned
without explicit conversion or casting to a value of this type.
-
isAssignable(long)
- Determines if a specified constant value can be assigned
without explicit conversion or casting to a value of this type.
-
isAssignableFrom(DTClass)
- Determines if the class or interface
represented by this DTClass object is either the same as, or is a
superclass or superinterface of, the class or interface
represented by the specified DTClass parameter.
-
isImplementationOf(DTClass)
- Determines if the class or interface
represented by this DTClass object implements or extends
the class or interface represented by the specified DTClass parameter.
-
isInteger()
- Return true if the argument is a byte, short, int or long.
-
isInterface()
- Determines if the specified DTClass object represents an interface type.
-
isNumeric()
- Return true if the argument is a number, i.e.,
byte, short, int, long, float or double.
-
isPrimitive()
- Determines if the specified DTClass object represents a primitive Java
type.
-
isProjectClass()
- Return true if class is in a project, as opposed to component
library or system classpath.
-
isSuperclass(DTClass)
- Returns true if the argument object is a superclass of the current class.
-
isValid()
- Return value of last validate().
-
nonNull()
- nonNull does nothing except throw a NullPointerException if
called with null DTClass reference
-
nonNull(Object)
- nonNull does nothing except throw a NullPointerException if
called with null reference
-
nonNull(DTClass[])
- nonNull does nothing except throw a NullPointerException if
called with a null DTClass[] reference or if any of its
components are null.
-
rename(String)
- Renames a type to new name
param newName: The new name of the class
-
scanDim(String)
-
-
toString()
- Converts the object to a string.
-
validate()
- Validate that the class still exists and the information about
the class is correct.
AnyType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass AnyType
BooleanType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass BooleanType
ByteType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass ByteType
CharacterType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass CharacterType
DoubleType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass DoubleType
FloatType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass FloatType
IntegerType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass IntegerType
LongType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass LongType
NullType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass NullType
ShortType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass ShortType
VoidType
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass VoidType
cacheFlushDelay
public static int cacheFlushDelay
DTClass
protected DTClass(DTClass primitiveType,
int dim)
- Constructor used locally for primitive array types (boolean[], char[], etc).
DTClass
protected DTClass(VisualProject project,
String name,
Class clazz,
int dim,
boolean primitive,
boolean projectClass)
- Constructor used locally to make a DTClass, usually from a system java.lang.Class
DTClass
protected DTClass()
classnameToString
protected static java.lang.String classnameToString(String name)
componentName
protected static java.lang.String componentName(String str)
equals
public boolean equals(Object obj)
- Return true if the other class is the same as this.
If classes are equal and both are valid,
all of the information about the class is the same.
- Parameters:
- other - class to be compared.
- Overrides:
- equals in class Object
equals
public boolean equals(DTClass other)
- Return true if the other class is the same as this.
If classes are equal and both are valid,
all of the information about the class is the same.
- Parameters:
- other - class to be compared.
findClass
public static com.symantec.itools.vcafe.openapi.dtreflect.DTClass findClass(VisualProject project,
String className)
- Returns the
DTClass
object associated with the class
with the given string name.
Given a project and the fully-qualified name for a class or interface, this
method attempts to create a DTClass object for the class. If it
succeeds, returns the DTClass object representing the class. If
it fails, the method returns null.
For example, the following code fragment returns the runtime
DTClass
descriptor for the class named
com.user.MyClass
:
DTClass t = DTClass.findClass(aproject, "com.user.MyClass")
Array classes are represented using standard notation, e.g.,
"java.lang.String[]" and "byte[][]".
If the className names a system class or the project is null,
findClass() is the same as findSystemClass(). NB: A project must
be specified for a component library class, which is not in the
system classpath.
- Parameters:
- project - the project context that defines the class.
- className - the fully qualified name of the desired class.
- Returns:
- the
DTClass
descriptor for the class with the
specified name. Returns null if class not found.
- See Also:
- getDTClassObject(), findSystemClass()
findSystemClass
public static com.symantec.itools.vcafe.openapi.dtreflect.DTClass findSystemClass(String className)
- Returns the
DTClass
object associated with the class
with the given string name.
The class must be loadable from the system classpath.
For example, the following code fragment returns the runtime
DTClass
descriptor for the standard String class:
DTClass t = DTClass.findSystemClass("java.lang.String")
- Parameters:
- className - the fully qualified name of the desired class.
- Returns:
- the
DTClass
descriptor for the class with the
specified name. Returns null if class not found.
getAccessibleFields
public com.symantec.itools.vcafe.openapi.dtreflect.DTField[] getAccessibleFields(DTClass accessibleByClass,
boolean sameObject)
- Returns an array of DTField objects reflecting all the fields
in the class or interface represented by this DTClass object that
can be seen by accessibleBy.
This includes all public fields, protected fields if accessibleBy is
a subclass of this class (and they represent the same object), and
fields with package access if accessibleBy is in the same package as this class.
Inherited fields are included.
Returns an array of length 0 if the class or interface declares no fields,
or if this DTClass object represents a primitive type.
- See Also:
- getFields
getAccessibleMethods
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod[] getAccessibleMethods(DTClass accessibleByClass,
boolean sameObject)
- Returns an array of DTMethod objects reflecting all the methods
in the class or interface represented by this DTClass object that
can be seen by accessibleBy.
This includes all public methods, protected methods if accessibleBy is
a subclass of this class (and they represent the same object), and
methods with package access if accessibleBy is in the same package as this class.
Inherited methods are included.
Returns an array of length 0 if the class or interface declares no methods,
or if this DTClass object represents a primitive type.
- See Also:
- getMethods
getBounds
public int[] getBounds()
- Return an array with the bounds of each array dimension
for the current class.The length of the returned int array
is equal to the number of dimensions of the class.
Returns empty array if the class is not an array.
getClasses
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] getClasses()
- Returns an array containing DTClass objects representing all the
public classes and interfaces that are members of the class
represented by this DTClass object. This includes public class
and interface members inherited from superclasses and public
class and interface members declared by the class. Returns an
array of length 0 if the class has no public member classes or
interfaces, or if this DTClass object represents a primitive
type.
getClassname
protected static java.lang.String getClassname(String name,
int dim)
- Derive a java class name, given a name in our internal format.
for example, this turns "java.lang.Object[]",1 into "[Ljava.lang.Object;"
getClosestMember
public com.symantec.itools.vcafe.openapi.dtreflect.DTMember getClosestMember(int location)
- Gets the closest member to the location. The closest member is the member with a
source range or Javadoc range that surrounds the location
getComponentName
public java.lang.String getComponentName()
- If this class represents an array type, returns the name
of the component type; otherwise
returns the class name.
getComponentType
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass getComponentType()
- If this class represents an array type, returns the DTClass
object representing the component type of the array; otherwise
returns null.
getConstructor
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor getConstructor(DTClass[] parameterTypes)
- Returns a DTConstructor object that reflects the specified public
constructor of the class represented by this DTClass object. The
parameterTypes parameter is an array of DTClass objects that
identify the constructor's formal parameter types, in declared
order.
The constructor to reflect is located by searching all the
constructors of the class represented by this DTClass object for
a public constructor with the exactly the same formal parameter
types.
- Returns:
- constructor or null if no such constructor.
- See Also:
- DTConstructor
getConstructor
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor getConstructor(String[] parameterTypeNames)
- Returns a DTConstructor object that reflects the specified public
constructor of the class represented by this DTClass object. The
parameterTypeNames parameter is an array of String objects that
identify the constructor's formal parameter types, in declared
order.
The constructor to reflect is located by searching all the
constructors of the class represented by this DTClass object for
a public constructor with the exactly the same formal parameter
types.
- Returns:
- constructor or null if no such constructor.
- See Also:
- DTConstructor
getConstructors
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor[] getConstructors()
- Returns an array containing DTConstructor objects reflecting
all the public constructors of the class represented by this
DTClass object. An array of length 0 is returned if the class
has no public constructors.
- See Also:
- DTConstructor
getDeclaredClasses
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] getDeclaredClasses()
- Returns an array of DTClass objects reflecting all the classes
and interfaces declared as members of the class represented by
this DTClass object. This includes public, protected, default
(package) access, and private classes and interfaces declared
by the class, but excludes inherited classes and interfaces.
Returns an array of length 0 if the class declares no classes
or interfaces as members, or if this DTClass object represents a
primitive type.
getDeclaredConstructor
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor getDeclaredConstructor(DTClass[] parameterTypes)
- Returns a DTConstructor object that reflects the specified declared
constructor of the class or interface represented by this DTClass
object. The parameterTypes parameter is an array of DTClass
objects that identify the constructor's formal parameter types,
in declared order.
- See Also:
- DTConstructor
getDeclaredConstructor
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor getDeclaredConstructor(String[] parameterTypeNames)
- Returns a DTConstructor object that reflects the specified declared
constructor of the class or interface represented by this DTClass
object. The parameterTypeNames parameter is an array of String
objects that identify the constructor's formal parameter types,
in declared order.
- See Also:
- DTConstructor
getDeclaredConstructors
public com.symantec.itools.vcafe.openapi.dtreflect.DTConstructor[] getDeclaredConstructors()
- Returns an array of DTConstructor objects reflecting all the
constructors declared by the class represented by this DTClass
object. These are public, protected, default (package) access,
and private constructors. Returns an array of length 0 if this
DTClass object represents an interface or a primitive type.
See The Java Language Specification, section 8.2.
- See Also:
- DTConstructor
getDeclaredField
public com.symantec.itools.vcafe.openapi.dtreflect.DTField getDeclaredField(String name)
- Returns a DTField object that reflects the specified declared
field of the class or interface represented by this DTClass
object. The name parameter is a String that specifies the
simple name of the desired field.
- See Also:
- DTField
getDeclaredFields
public com.symantec.itools.vcafe.openapi.dtreflect.DTField[] getDeclaredFields()
- Returns an array of DTField objects reflecting all the fields
declared by the class or interface represented by this DTClass
object. This includes public, protected, default (package)
access, and private fields, but excludes inherited
fields. Returns an array of length 0 if the class or interface
declares no fields, or if this DTClass object represents a
primitive type.
See The Java Language Specification, sections 8.2 and
8.3.
- See Also:
- DTField
getDeclaredMethod
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod getDeclaredMethod(String name,
DTClass[] parameterTypes)
- Returns a DTMethod object that reflects the specified declared
method of the class or interface represented by this DTClass
object. The name parameter is a String that specifies the
simple name of the desired method, and the parameterTypes
parameter is an array of DTClass objects that identify the
method's formal parameter types, in declared order.
- See Also:
- DTMethod
getDeclaredMethod
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod getDeclaredMethod(String name,
String[] parameterTypeNames)
- Returns a DTMethod object that reflects the specified declared
method of the class or interface represented by this DTClass
object. The name parameter is a String that specifies the
simple name of the desired method, and the parameterTypeNames
parameter is an array of DTClass objects that identify the
method's formal parameter types, in declared order.
- See Also:
- DTMethod
getDeclaredMethods
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod[] getDeclaredMethods()
- Returns an array of DTMethod objects reflecting all the methods
declared by the class or interface represented by this DTClass
object. This includes public, protected, default (package)
access, and private methods, but excludes inherited
methods. Returns an array of length 0 if the class or interface
declares no methods, or if this DTClass object represents a
primitive type.
See The Java Language Specification, section 8.2.
- See Also:
- DTMethod
getDeclaringClass
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass getDeclaringClass()
- If the class or interface represented by this DTClass object is
a member of another class, returns the DTClass object
representing the class of which it is a member (its
declaring class). Returns null if this class or
interface is not a member of any other class.
getDimensions
public int getDimensions()
- If this DTClass object represents an array type, returns the number of array dimensions,
otherwise returns false.
getField
public com.symantec.itools.vcafe.openapi.dtreflect.DTField getField(String name)
- Returns a DTField object that reflects the specified public
member field of the class or interface represented by
this DTClass object. The name parameter is a String specifying
the simple name of the desired field.
The field to be reflected is located by searching all the
member fields of the class or interface represented by this
DTClass object for a public field with the specified name.
See The Java Language Specification, sections 8.2 and 8.3.
- Returns:
- field or null if no such field.
- See Also:
- DTField
getFields
public com.symantec.itools.vcafe.openapi.dtreflect.DTField[] getFields()
- Returns an array containing DTField objects reflecting all the
accessible public fields of the class or interface represented
by this DTClass object. Returns an array of length 0 if the
class or interface has no accessible public fields, or if it
represents an array type or a primitive type.
Specifically, if this DTClass object represents a class,
returns the public fields of this class and of all its
superclasses. If this DTClass object represents an interface,
returns the fields of this interface and of all its
superinterfaces. If this DTClass object represents an array type
or a primitive type, returns an array of length 0.
The implicit length field for array types is not reflected
by this method. User code should use the methods of class Array
to manipulate arrays.
See The Java Language Specification, sections 8.2 and 8.3.
- See Also:
- DTField
getInterfaces
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] getInterfaces()
- Determines the interfaces implemented by the class or interface
represented by this object.
If this object represents a class, the return value is an array
containing objects representing all interfaces implemented by the
class. The order of the interface objects in the array corresponds
to the order of the interface names in the implements
clause of the declaration of the class represented by this object.
If this object represents an interface, the array contains
objects representing all interfaces extended by the interface. The
order of the interface objects in the array corresponds to the
order of the interface names in the extends clause of
the declaration of the interface represented by this object.
If the class or interface implements no interfaces, the method
returns an array of length 0.
- Returns:
- an array of interfaces implemented by this class.
getJavadocRange
public com.symantec.itools.vcafe.openapi.Range getJavadocRange()
- gets the text range from the beginning of the first line of the class' Javadoc comment
to the closing asterisk-slash characters
getMethod
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod getMethod(String name,
DTClass[] parameterTypes)
- Returns a DTMethod object that reflects the specified public
member method of the class or interface represented by this
DTClass object. The name parameter is a String specifying the
simple name the desired method, and the parameterTypes
parameter is an array of DTClass objects that identify the
method's formal parameter types, in declared order.
The method to reflect is located by searching all the member
methods of the class or interface represented by this DTClass
object for a public method with the specified name and exactly
the same formal parameter types.
See The Java Language Specification, sections 8.2
and 8.4.
- Returns:
- method or null if no such method.
- See Also:
- DTMethod
getMethod
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod getMethod(String name,
String[] parameterTypeNames)
- Returns a DTMethod object that reflects the specified public
member method of the class or interface represented by this
DTClass object. The name parameter is a String specifying the
simple name the desired method, and the parameterTypeNames
parameter is an array of String objects that identify the
method's formal parameter types, in declared order.
The method to reflect is located by searching all the member
methods of the class or interface represented by this DTClass
object for a public method with the specified name and exactly
the same formal parameter types.
See The Java Language Specification, sections 8.2
and 8.4.
- Returns:
- method or null if no such method.
- See Also:
- DTMethod
getMethods
public com.symantec.itools.vcafe.openapi.dtreflect.DTMethod[] getMethods()
- Returns an array containing DTMethod objects reflecting all the
public member methods of the class or interface
represented by this DTClass object, including those declared by
the class or interface and and those inherited from
superclasses and superinterfaces. Returns an array of length 0
if the class or interface has no public member methods.
See The Java Language Specification, sections 8.2
and 8.4.
- See Also:
- DTMethod
getModifiers
public int getModifiers()
- Returns the Java language modifiers for this class or
interface, encoded in an integer. The modifiers consist of the
Java Virtual Machine's constants for public, protected,
private, final, and interface; they should be decoded using the
methods of class Modifier.
The modifier encodings are defined in The Java Virtual
Machine Specification, table 4.1.
- See Also:
- Modifier
getName
public java.lang.String getName()
- Returns the fully-qualified name of the type (class, interface,
array, or primitive) represented by this DTClass object, as a String.
Array classes are named using standard notation, e.g.,
"java.lang.String[]" and "byte[][]".
getPackageName
public java.lang.String getPackageName()
- Returns the package of the type (class, interface, array, or primitive) represented
by this DTClass object as a String, or null if the class isn't in a package
getPrimitiveClass
public static com.symantec.itools.vcafe.openapi.dtreflect.DTClass getPrimitiveClass(String name)
- Return a DTClass object for the named primitive type.
- Returns:
- null if name is not a primitive type
getProject
public com.symantec.itools.vcafe.openapi.VisualProject getProject()
- Return the VisualProject that defines the class, or null for a system class.
getProjectFile
public com.symantec.itools.vcafe.openapi.ProjectFile getProjectFile()
- Return the ProjectFile that defines the class, or null for a system class.
getProjectFileID
public int getProjectFileID()
- Return the ID of the ProjectFile that defines the class, or 0 for a system class.
getProjectLoader
public java.lang.ClassLoader getProjectLoader()
- Return classloader for this class (project's classloader).
getSourceFile
public com.symantec.itools.vcafe.openapi.SourceFile getSourceFile()
- Return the SourceFile that contains the class, or null if not found.
getSourceRange
public com.symantec.itools.vcafe.openapi.Range getSourceRange()
- gets the text range from the beginning of the "class" statement to the closing brace
getSuperclass
public com.symantec.itools.vcafe.openapi.dtreflect.DTClass getSuperclass()
- If this object represents any class other than the class
Object, then the object that represents the superclass
of that class is returned.
If this object is the one that represents the class
Object or this object represents an interface,
null is returned.
- Returns:
- the superclass of the class represented by this object.
getUnqualifiedName
public java.lang.String getUnqualifiedName()
- Returns the unqualified name (package is excluded) of the type (class, interface,
array, or primitive) represented by this DTClass object, as a String.
Array classes are named using standard notation, e.g.,
"String[]" and "byte[][]".
isArray
public boolean isArray()
- If this DTClass object represents an array type, returns true,
otherwise returns false.
isAssignable
public boolean isAssignable(DTClass cls)
- Determines if a value of a specified type can be assigned
without explicit conversion or casting to a value of this type.
Differs from isAssignableFrom() in its treatment of primitive
classes.
Specifically, this method tests whether the type represented
by the specified DTClass parameter can be converted to the type
represented by this DTClass object via an identity conversion,
a widening reference conversion or a widening numeric conversion.
See The Java Language Specification, sections 5.1.1, 5.1.4
and 5.2, for details.
Note that a particular numeric constant value might be assignable
via a narrowing conversion if its value fits in the destination
type without loss of information, e.g., byte b = 52; where the
constant 52 is an int. This must be tested using isAssignable(int)
with the specific value.
- Throws: NullPointerException
- if the specified DTClass parameter is null.
isAssignable
public boolean isAssignable(long value)
- Determines if a specified constant value can be assigned
without explicit conversion or casting to a value of this type.
A particular numeric constant value is assignable if its value
fits in the destination
type without loss of information, e.g., byte b = 52; where the
constant 52 is an int.
isAssignableFrom
public boolean isAssignableFrom(DTClass cls)
- Determines if the class or interface
represented by this DTClass object is either the same as, or is a
superclass or superinterface of, the class or interface
represented by the specified DTClass parameter. It returns true
if so, false otherwise. If this DTClass object represents a
primitive type, returns true if the specified DTClass parameter
is exactly this DTClass object, false otherwise.
Specifically, this method tests whether the type represented
by the specified DTClass parameter can be converted to the type
represented by this DTClass object via an identity conversion or
via a widening reference conversion. See The Java Language
Specification, sections 5.1.1 and 5.1.4 , for details.
This method works the same as Class.isAssignableFrom(), which
means it is not accurate for primitive classes.
- Throws: NullPointerException
- if the specified DTClass parameter is null.
- See Also:
- isAssignable
isImplementationOf
public boolean isImplementationOf(DTClass cls)
- Determines if the class or interface
represented by this DTClass object implements or extends
the class or interface represented by the specified DTClass parameter.
It returns true if so, false otherwise. If this DTClass object represents a
primitive type, returns true if the specified DTClass parameter
is exactly this DTClass object, false otherwise.
For non-primitive types, returns what the implements operator
would for corresponding Class objects.
This is the opposite of isAssignableFrom().
- Throws: NullPointerException
- if the specified DTClass parameter is null.
isInteger
public boolean isInteger()
- Return true if the argument is a byte, short, int or long.
isInterface
public boolean isInterface()
- Determines if the specified DTClass object represents an interface type.
- Returns:
-
true
if this object represents an interface;
false
otherwise.
isNumeric
public boolean isNumeric()
- Return true if the argument is a number, i.e.,
byte, short, int, long, float or double.
isPrimitive
public boolean isPrimitive()
- Determines if the specified DTClass object represents a primitive Java
type.
There are nine predefined DTClass objects to represent the eight
primitive Java types and void. These are created by the DTReflection API,
and have the same names as the primitive types
that they represent, namely boolean, byte, char, short, int,
long, float, and double, and void.
These objects may only be accessed via the following public
static final variables, and are the only DTClass objects for
which this method returns true.
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.BooleanType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.CharacterType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.ByteType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.ShortType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.IntegerType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.LongType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.FloatType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.DoubleType
com.symantec.itools.vcafe.openapi.dtreflect.DTClass.VoidType
isProjectClass
public boolean isProjectClass()
- Return true if class is in a project, as opposed to component
library or system classpath.
isSuperclass
public boolean isSuperclass(DTClass superClass)
- Returns true if the argument object is a superclass of the current class.
isValid
public boolean isValid()
- Return value of last validate().
nonNull
public final com.symantec.itools.vcafe.openapi.dtreflect.DTClass nonNull()
- nonNull does nothing except throw a NullPointerException if
called with null DTClass reference
- Returns:
- reference to calling object
nonNull
public final java.lang.Object nonNull(Object obj)
- nonNull does nothing except throw a NullPointerException if
called with null reference
- Returns:
- reference to calling object
nonNull
public static final com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] nonNull(DTClass[] array)
- nonNull does nothing except throw a NullPointerException if
called with a null DTClass[] reference or if any of its
components are null.
#
- Parameters:
- array - of DTClass references
- Returns:
- reference to array argument
rename
public boolean rename(String newName)
- Renames a type to new name
param newName: The new name of the class
- Returns:
- Success (true) or failure (false)...
scanDim
protected static int scanDim(String className)
toString
public java.lang.String toString()
- Converts the object to a string. The string representation is the
string
"class"
or "interface"
followed
by a space and then the fully qualified name of the class.
If this DTClass object represents a primitive type,
returns the name of the primitive type.
- Returns:
- a string representation of this class object.
- Overrides:
- toString in class Object
validate
public boolean validate()
- Validate that the class still exists and the information about
the class is correct. Sets the valid flag to the result of
validate().
- Returns:
- true if the DTClass object is valid, false otherwise.
All Packages Class Hierarchy This Package Previous Next Index