Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xml.utils.synthetic
Class Class

    java.lang.Object
      |
      +--org.apache.xml.utils.synthetic.Class

public class Class
extends java.lang.Object
implements java.io.Serializable

**For internal use only** org.apache.xml.utils.synthetic.Class is a mutable equivalent of java.lang.Class. Instances represent classes and interfaces in a running Java application, or class descriptions under construction. In the former case, org.apache.xml.utils.synthetic.Class operates as a proxy for the "real" java.lang.Class object; in the latter, it consults data structures defined in the org.apache.xml.utils.synthetic.reflection.* package.

Unlike java.lang.Class, org.apache.xml.utils.synthetic.Class has a pair of factories (fromName and fromClass). It can also be switched from synthetic to proxy operation after construction, by setting the realClass property; this is intended to allow these definitions to be "compiled in place".

For convenient use, org.apache.xml.utils.synthetic.Class implements an extended version of the java.lang.Class API -- but is not a subclass thereof, since java.lang.Class is Final (presumably for security reasons).

DEVELOPMENT NOTE: Methods not yet implemented will throw IllegalStateException

I've added code to convert primitive names into their TYPEs, to accept foo[] as a synonym for [Lfoo, and to generate the right thing on output (getJava[Short]Name). Useful extension for code generation from Java-like source. We may want to factor these and toSource out, making org.apache.xml.utils.synthetic.Class addess only the JVM level and providing subclasses or access tools that handle language syntax (Java source, NetRexx source, etc.)

Since:
  2000/2/10
See Also:
  Serialized Form

Method Summary
`void` | `addExtends(Class newclass)` Adds an "extends" description for the class or interface represented by this Class object
`void` | `addImplements(Class newclass)` Adds an "implements" description for the class or interface represented by this Class object
`static Class` | `declareClass(java.lang.String className)` Start to create a synthetic Class with the given fully-qualified name.
`Constructor` | `declareConstructor()` Adds a Constructor description for the class or interface represented by this Class object
`Field` | `declareField(java.lang.String name)` Adds a Field description for the class or interface represented by this Class object
`Class` | `declareInnerClass(java.lang.String className)` Declare a class contained within this class.
`Class` | `declareInterface(Class newifce)` State that this class implements a specified interface.
`Method` | `declareMethod(java.lang.String name)` Adds a Method description for the class or interface represented by this Class object
`static Class` | `forClass(java.lang.Class cls)` Returns the synthetic Class object associated with the "real" class specified, creating one if it didn't already exist.
`static Class` | `forName(java.lang.String className)` Returns the synthetic Class object associated with the class with the given fully-qualified name.
`Class` | `forNameInContext(java.lang.String classname)` Like forName, but if the classname doesn't have a package prefix we first attempt to look it up as one of our own inner clases.
`Class[]` | `getClasses()` Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object.
`java.lang.ClassLoader` | `getClassLoader()` Determines the class loader for the class.
`Class` | `getComponentType()` If this class represents an array type, returns the Class object representing the component type of the array; otherwise returns null.
`Constructor` | `getConstructor(Class[] parameterTypes)` Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object.
`Constructor[]` | `getConstructors()` Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object.
`Class[]` | `getDeclaredClasses()` This method is not implemented in VAJAVA 3.0
`Constructor` | `getDeclaredConstructor(Class[] parameterTypes)` Returns a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object.
`Constructor[]` | `getDeclaredConstructors()` Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object.
`Field` | `getDeclaredField(java.lang.String name)` Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.
`Field[]` | `getDeclaredFields()` Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object.
`Method` | `getDeclaredMethod(java.lang.String name, Class[] parameterTypes)` Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object.
`Method[]` | `getDeclaredMethods()` Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class object.
`Class` | `getDeclaringClass()` This method is not implemented in VAJava 3.0
`Field` | `getField(java.lang.String name)` Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object.
`Field[]` | `getFields()` Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object.
`Class[]` | `getInnerClasses()` Fetch a list of classes contained within this class.
`Class[]` | `getInterfaces()` Determines the interfaces implemented by the class or interface represented by this object.
`java.lang.String` | `getJavaName()` Like getName, but back-convert array notation escapes.
`java.lang.String` | `getJavaShortName()` Like getShortName, but back-convert array notation escapes.
`Method` | `getMethod(java.lang.String name, Class[] parameterTypes)` Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.
`Method[]` | `getMethods()` Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces.
`int` | `getModifiers()` Returns the Java language modifiers for this class or interface, encoded in an integer.
`java.lang.String` | `getName()` Retrieve the fully-qualified classname.
`java.lang.String` | `getPackageName()` Extract the package name for this class.
`java.lang.Class` | `getRealClass()` If this synthetic class is a wrapper for a "real" java.lang.Class -- either because it was instantiated as such or because it has been compiled -- this method will return that class.
`java.net.URL` | `getResource(java.lang.String name)` Finds a resource with the specified name.
`java.io.InputStream` | `getResourceAsStream(java.lang.String name)` Finds a resource with a given name.
`java.lang.String` | `getShortName()` Extract just the local name of this class, minus the package prefix.
`java.lang.Object[]` | `getSigners()` Get the signers of this class.
`Class` | `getSuperclass()` If this object represents any class other than the class Object, then the object that represents the superclass of that class is returned.
`boolean` | `isArray()` If this Class object represents an array type, returns true, otherwise returns false.
`boolean` | `isAssignableFrom(Class cls)` Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.
`boolean` | `isAssignableFrom(java.lang.Class cls)` Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.
`boolean` | `isInstance(java.lang.Object obj)` This method is the dynamic equivalent of the Java language instanceof operator.
`boolean` | `isInterface()` Determines if the specified Class object represents an interface type.
`void` | `isInterface(boolean isInterface)` Assert that the specified Class object represents an interface type.
`boolean` | `isPrimitive()` Determines if the specified Class object represents a primitive Java type.
`static int` | `modifierFromString(java.lang.String t)` Method modifierFromString
`static int` | `modifiersFromString(java.lang.String s)` Method modifiersFromString
`java.lang.Object` | `newInstance()` Creates a new instance of a class.
`static Class` | `reallyDeclareClass(java.lang.String className)` Start to create a synthetic Class with the given fully-qualified name.
`void` | `setModifiers(int modifiers)` Set the Java language modifiers for this class or interface, encoded in an integer.
`void` | `setRealClass(java.lang.Class realclass)` This call is intended to allow an existing org.apache.xml.utils.synthetic.Class to be switched from purely descriptive mode to proxy mode ("reified").
`void` | `setSuperClass(Class superclass)` Set the superclass for this synthetic class.
`void` | `setSuperClass(java.lang.Class superclass)` Set the superclass for this synthetic class.
`void` | `toSource(java.io.OutputStream out, int depth)` Convenience for writing to, eg, System.out
`void` | `toSource(java.io.PrintWriter out, int depth)` Converts the object to a Java code stream.
`java.lang.String` | `toString()` Converts the object to a string.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### forClass

    public static Class forClass(java.lang.Class cls)

  Returns the synthetic Class object associated with the "real" class specified, creating one if it didn't already exist.

  For example, the following code fragment returns the runtime Class descriptor for the class named mypackage.MyClass. `Class t = Class.forName(java.lang.Class.forName("mypackage.MyClass"))`

  Note that if the user has manually created a org.apache.xml.utils.synthetic.Class with the same name before this call is issued, that object will be found instead. See also the declareClass call.

  We need a better way to declare/define array classes, given a class object (synthetic or not).

  Parameters:
    `cls` - the desired Java class.
  Returns:
    the synthetic Class descriptor for the specified class.

### forNameInContext

    public Class forNameInContext(java.lang.String classname)
                           throws java.lang.ClassNotFoundException

  Like forName, but if the classname doesn't have a package prefix we first attempt to look it up as one of our own inner clases. As with forName, if this can not be resolved we throw an exception.
  Parameters:
    `classname` - the full or partial class name.
  Returns:
    The Class name that matches the argument.
  Throws:
    java.lang.ClassNotFoundException -

### forName

    public static Class forName(java.lang.String className)
                         throws java.lang.ClassNotFoundException

  Returns the synthetic Class object associated with the class with the given fully-qualified name. If there isn't one, this method attempts to locate, load and link the standard java Class. If it succeeds, it returns a wrapped version of the Class object representing the class. If it fails, the method throws a ClassNotFoundException.

  For example, the following code fragment returns the runtime Class descriptor for the class named mypackage.MyClass -- either as a synthetic or as a standard Java class. `Class t = Class.forName("mypackage.MyClass")`

  I've added support for arrays -- assuming any name that ends with ']' is an array. It probably needs to be made smarter, possibly via a subclass of org.apache.xml.utils.synthetic.Class.

  Parameters:
    `className` - the fully qualified name of the desired class.
  Returns:
    the synthetic Class descriptor for the class with the specified name.
  Throws:
    java.lang.ClassNotFoundException - if the class could not be found.

### declareClass

    public static Class declareClass(java.lang.String className)
                              throws SynthesisException

  Start to create a synthetic Class with the given fully-qualified name. If a Class by that name already exists, and it is not reified, it will be returned instead. If a reified Class _does_ exist, we throw a synthesis exception.
  Parameters:
    `className` - the fully qualified name of the desired class.
  Returns:
    the synthetic Class descriptor for the class with the specified name.
  Throws:
    SynthesisException - if the class has been reified.

### reallyDeclareClass

    public static Class reallyDeclareClass(java.lang.String className)

  Start to create a synthetic Class with the given fully-qualified name. If a Class by that name already exists,whether reified or not, it will be removed from the table and replaced by the new synthesis. NOTE THAT the replacement will not affect classes which have already refernced the old version. We could change that by having everyone reference everyone else via an indirection table.
  Parameters:
    `className` - the fully qualified name of the desired class.
  Returns:
    the synthetic Class descriptor for the class with the specified name.

### getClasses

    public Class[] getClasses()

  Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class 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 Class object represents a primitive type.

  NOTE: In a significant number of existing Java environments, this method is not implemented by the official Class object and always returns an empty array. So if you don't get any useful information from a proxied java.lang.Class, don't be surprised. I'm not sure if someone decided it was a potential security issue, or if Sun was lazy and everyone else followed suit.

  ALSO NOTE: The above spec, as taken from java.lang.Class, doesn't provide any good way to distinguish the immediate superclass from all other superclasses. That makes it only marginally useful, which is no doubt one of the reasons folks have declined to implement it.

  Returns:
    an array of classes.

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Determines the class loader for the class. the class loader that created the class or interface represented by this object, or null if the org.apache.xml.utils.synthetic.Class was not created by a class loader.

### getComponentType

    public Class getComponentType()

  If this class represents an array type, returns the Class object representing the component type of the array; otherwise returns null.

  NOTE: Since org.apache.xml.utils.synthetic.Class doesn't yet attempt to model array types, this will currently return false unless we are proxying such a type.

  Returns:
    the Class object representing the component type of the array, otherwise returns null.

### getConstructor

    public Constructor getConstructor(Class[] parameterTypes)
                               throws java.lang.NoSuchMethodException,
                                      java.lang.SecurityException,
                                      SynthesisException

  Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object. The parameterTypes parameter is an array of Class 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 Class object for a public constructor with the exactly the same formal parameter types.

  Parameters:
    `parameterTypes` - array of Class objects that identify the constructor's formal parameter types, in declared order.
  Returns:
    a Constructor object that reflects the specified public constructor of the class represented by this Class object.
  Throws:
    java.lang.NoSuchMethodException - if a matching method is not found.
    java.lang.SecurityException - if access to the information is denied.
    SynthesisException -

### getConstructors

    public Constructor[] getConstructors()
                                  throws java.lang.SecurityException

  Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object. An array of length 0 is returned if the class has no public constructors.
  Returns:
    an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object.
  Throws:
    java.lang.SecurityException - if access to the information is denied.

### getDeclaredClasses

    public Class[] getDeclaredClasses()
                               throws java.lang.SecurityException

  This method is not implemented in VAJAVA 3.0

  Returns an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class 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 Class object represents a primitive type.

  Returns:
    an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class object.
  Throws:
    java.lang.SecurityException - if access to the information is denied.

### addExtends

    public void addExtends(Class newclass)
                    throws SynthesisException

  Adds an "extends" description for the class or interface represented by this Class object
  Parameters:
    `newclass` - The class that this class extends.
  Throws:
    SynthesisException - if the class has been reified.

### getDeclaredConstructor

    public Constructor getDeclaredConstructor(Class[] parameterTypes)
                                       throws java.lang.NoSuchMethodException,
                                              java.lang.SecurityException

  Returns a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object. The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order.
  Parameters:
    `parameterTypes` - array of Class objects that identify the constructor's formal parameter types, in declared order.
  Returns:
    a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object.
  Throws:
    java.lang.NoSuchMethodException - if a matching method is not found.
    java.lang.SecurityException - if access to the information is denied.

### declareConstructor

    public Constructor declareConstructor()
                                   throws SynthesisException

  Adds a Constructor description for the class or interface represented by this Class object
  Returns:
    The constructor object.
  Throws:
    SynthesisException - if the class has been reified.

### declareInterface

    public Class declareInterface(Class newifce)
                           throws SynthesisException

  State that this class implements a specified interface. This does not yet update allMethods or otherwise attempt to inherit data.
  Parameters:
    `newifce` - org.apache.xml.utils.synthetic.Class representing the interface we want to add.
  Returns:
    The new interface class.
  Throws:
    SynthesisException - if the Class isn't an interface

### getDeclaredConstructors

    public Constructor[] getDeclaredConstructors()
                                          throws java.lang.SecurityException

  Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object. These are public, protected, default (package) access, and private constructors. Returns an array of length 0 if this Class object represents an interface or a primitive type.

  See The Java Language Specification, section 8.2.

  Returns:
    an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object.
  Throws:
    java.lang.SecurityException - if access to the information is denied.

### getDeclaredField

    public Field getDeclaredField(java.lang.String name)
                           throws java.lang.NoSuchFieldException,
                                  java.lang.SecurityException

  Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object. The name parameter is a String that specifies the simple name of the desired field.
  Parameters:
    `name` - String that specifies the simple name of the desired field.
  Returns:
    a Field object that reflects the specified declared field of the class or interface represented by this Class object.
  Throws:
    java.lang.NoSuchFieldException - if a field with the specified name is not found.
    java.lang.SecurityException - if access to the information is denied.

### declareField

    public Field declareField(java.lang.String name)
                       throws SynthesisException

  Adds a Field description for the class or interface represented by this Class object
  Parameters:
    `name` - The name of the field.
  Returns:
    The field description.
  Throws:
    SynthesisException - if the class has been reified.

### getDeclaredFields

    public Field[] getDeclaredFields()
                              throws java.lang.SecurityException

  Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class 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 Class object represents a primitive type. See The Java Language Specification, sections 8.2 and 8.3.
  Returns:
    array of Field objects reflecting all the fields declared by the class or interface represented by this Class object.
  Throws:
    java.lang.SecurityException - if access to the information is denied.

### getDeclaredMethod

    public Method getDeclaredMethod(java.lang.String name,
                                    Class[] parameterTypes)
                             throws java.lang.NoSuchMethodException,
                                    java.lang.SecurityException

  Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object. The name parameter is a String that specifies the simple name of the desired method, and the parameterTypes parameter is an array of Class objects that identify the method's formal parameter types, in declared order.
  Parameters:
    `name` - String that specifies the simple name of the desired method.
    `parameterTypes` - array of Class objects that identify the method's formal parameter types, in declared order.
  Returns:
    Method object that reflects the specified declared method of the class or interface represented by this Class object.
  Throws:
    java.lang.NoSuchMethodException - if a matching method is not found.
    java.lang.SecurityException - if access to the information is denied.

### declareMethod

    public Method declareMethod(java.lang.String name)
                         throws SynthesisException

  Adds a Method description for the class or interface represented by this Class object
  Parameters:
    `name` - Name of method.
  Returns:
    The method object.
  Throws:
    SynthesisException - if the class has been reified.

### getDeclaredMethods

    public Method[] getDeclaredMethods()
                                throws java.lang.SecurityException

  Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class 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 Class object represents a primitive type.

  See The Java Language Specification, section 8.2.

  Returns:
    array of Method objects reflecting all the methods declared by the class or interface represented by this Class object.
  Throws:
    java.lang.SecurityException - if access to the information is denied.

### getDeclaringClass

    public Class getDeclaringClass()

  This method is not implemented in VAJava 3.0

  If the class or interface represented by this Class object is a member of another class, returns the Class 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.

### declareInnerClass

    public Class declareInnerClass(java.lang.String className)
                            throws SynthesisException

  Declare a class contained within this class. This doesn't address anonymous classes (those go inside method bodies and similar code), just local classes.

  ***** This requires lookup methods that operate in the context of a specific class, and per-class registries!

  Parameters:
    `className` - Local name of inner class to create. This should _not_ be a qualified name, unlike the normal forName() call. Its hierarchy is established by the class within which it is created.
  Returns:
    org.apache.xml.utils.synthetic.Class object for the contained class.
  Throws:
    SynthesisException - if class could not be created.
    SynthesisException -
  Since:
    2/2000

### getInnerClasses

    public Class[] getInnerClasses()

  Fetch a list of classes contained within this class. This doesn't address anonymous classes (those go inside method bodies and similar code), just local classes.
  Returns:
    org.apache.xml.utils.synthetic.Class[] object for the contained classes. This may be empty if none such exist, or if the class is reified (since reflection doesn't report this information).
  Since:
    3/2000

### getField

    public Field getField(java.lang.String name)
                   throws java.lang.NoSuchFieldException,
                          java.lang.SecurityException

  Returns a Field object that reflects the specified public member field of the class or interface represented by this Class 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 Class object for a public field with the specified name.

  See The Java Language Specification, sections 8.2 and 8.3.

  Parameters:
    `name` -
  Throws:
    java.lang.NoSuchFieldException - if a field with the specified name is not found.
    java.lang.SecurityException - if access to the information is denied.

### getFields

    public Field[] getFields()
                      throws java.lang.SecurityException

  Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class 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 Class object represents a class, returns the public fields of this class and of all its superclasses. If this Class object represents an interface, returns the fields of this interface and of all its superinterfaces. If this Class 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.

  Throws:
    java.lang.SecurityException - if access to the information is denied.

### getInterfaces

    public Class[] 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. an array of interfaces implemented by this class.

### addImplements

    public void addImplements(Class newclass)
                       throws SynthesisException

  Adds an "implements" description for the class or interface represented by this Class object
  Parameters:
    `newclass` -
  Throws:
    SynthesisException - if the class has been reified.

### getMethod

    public Method getMethod(java.lang.String name,
                            Class[] parameterTypes)
                     throws java.lang.NoSuchMethodException,
                            java.lang.SecurityException

  Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object. The name parameter is a String specifying the simple name the desired method, and the parameterTypes parameter is an array of Class 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 Class 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.

  Parameters:
    `name` -
    `parameterTypes` -
  Throws:
    java.lang.NoSuchMethodException - if a matching method is not found.
    java.lang.SecurityException - if access to the information is denied.

### getMethods

    public Method[] getMethods()
                        throws java.lang.SecurityException

  Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class 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.

  Throws:
    java.lang.SecurityException - if access to the information is denied.

### 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: java.lang.reflect.Modifier

### setModifiers

    public void setModifiers(int modifiers)
                      throws SynthesisException

  Set 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: java.lang.reflect.Modifier
  Parameters:
    `modifiers` -
  Throws:
    SynthesisException -

### getName

    public java.lang.String getName()

  Retrieve the fully-qualified classname. If it's an array, it will be returned in JVM syntax, not Java syntax.
  Returns:
    java.lang.String
  Since:
    12/95

### getJavaName

    public java.lang.String getJavaName()

  Like getName, but back-convert array notation escapes. ***** DOESN'T YET HANDLE ARRAYS OF PRIMITIVES!
  Returns:
    java.lang.String
  Since:
    3/2000

### getShortName

    public java.lang.String getShortName()

  Extract just the local name of this class, minus the package prefix. ***** I don't think this handles array types properly yet.
  Returns:
    java.lang.String
  Since:
    12/99

### getJavaShortName

    public java.lang.String getJavaShortName()

  Like getShortName, but back-convert array notation escapes. ***** DOESN'T YET HANDLE ARRAYS OF PRIMITIVES!
  Returns:
    java.lang.String
  Since:
    3/2000

### getPackageName

    public java.lang.String getPackageName()

  Extract the package name for this class. ***** I don't think this handles array classes properly yet.
  Returns:
    java.lang.String
  Since:
    12/95

### getRealClass

    public java.lang.Class getRealClass()

  If this synthetic class is a wrapper for a "real" java.lang.Class -- either because it was instantiated as such or because it has been compiled -- this method will return that class. Otherwise it returns null. Creation date: (12-25-99 12:26:01 PM)
  Returns:
    org.apache.xml.utils.synthetic.Class

### setRealClass

    public void setRealClass(java.lang.Class realclass)
                      throws SynthesisException

  This call is intended to allow an existing org.apache.xml.utils.synthetic.Class to be switched from purely descriptive mode to proxy mode ("reified"). The primary intent is to allow a org.apache.xml.utils.synthetic.Class to be "compiled in place"

  This should have the side-effect of limiting further mutation of the org.apache.xml.utils.synthetic.Class to things which can not be obtained from the real Class object, to avoid "lying" to the user

  NOTE: Not all information defined by the Java libraries is in fact available in all Java environments. We assume the calls will work; if they return null or empty lists, there's nothing we can do about it. Note that this may mean that a reified class tells us less about itself than the synthetic description used to generate it.

  Creation date: (12-25-99 12:26:01 PM)

  Parameters:
    `java.lang.class` - realclass nonsynthetic Class object to proxy
    `realclass` -
  Throws:
    SynthesisException -

### setSuperClass

    public void setSuperClass(Class superclass)
                       throws SynthesisException

  Set the superclass for this synthetic class. Object is equivalent to Null. Creation date: (12-25-99 12:26:01 PM)
  Parameters:
    `superclass` -
  Returns:
    org.apache.xml.utils.synthetic.Class
  Throws:
    SynthesisException -

### setSuperClass

    public void setSuperClass(java.lang.Class superclass)
                       throws java.lang.ClassNotFoundException,
                              SynthesisException

  Set the superclass for this synthetic class. Creation date: (12-25-99 12:26:01 PM)
  Parameters:
    `superclass` -
  Returns:
    org.apache.xml.utils.synthetic.Class
  Throws:
    java.lang.ClassNotFoundException -
    SynthesisException -

### getResource

    public java.net.URL getResource(java.lang.String name)

  Finds a resource with the specified name. The rules for searching for resources associated with a given class are implemented by the class loader of the class.

  The Class methods delegate to ClassLoader methods, after applying a naming convention: if the resource name starts with "/", it is used as is. Otherwise, the name of the package is prepended, after converting "." to "/".

  Parameters:
    `name` - - the string representing the resource to be found. the URL object having the specified name, or null if no resource with the specified name is found.

### getResourceAsStream

    public java.io.InputStream getResourceAsStream(java.lang.String name)

  Finds a resource with a given name. Will return null if no resource with this name is found. The rules for searching a resources associated with a given class are implemented by the ClassLoader of the class.

  The Class methods delegate to ClassLoader methods, after applying a naming convention: if the resource name starts with "/", it is used as is. Otherwise, the name of the package is prepended, after converting "." to "/".

  Parameters:
    `name` - - the string representing the resource to be found the InputStream object having the specified name, or null if no resource with the specified name is found.

### getSigners

    public java.lang.Object[] getSigners()

  Get the signers of this class.

### getSuperclass

    public Class 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. the superclass of the class represented by this object.

### isArray

    public boolean isArray()

  If this Class object represents an array type, returns true, otherwise returns false.

### isAssignableFrom

    public boolean isAssignableFrom(Class cls)

  Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so, false otherwise. If this Class object represents a primitive type, returns true if the specified Class parameter is exactly this Class object, false otherwise.

  Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class 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.

  Parameters:
    `cls` -
  Throws:
    java.lang.NullPointerException - if the specified Class parameter is null.

### isAssignableFrom

    public boolean isAssignableFrom(java.lang.Class cls)

  Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so, false otherwise. If this Class object represents a primitive type, returns true if the specified Class parameter is exactly this Class object, false otherwise.

  Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class 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.

  Parameters:
    `cls` -
  Throws:
    java.lang.NullPointerException - if the specified Class parameter is null.

### isInstance

    public boolean isInstance(java.lang.Object obj)

  This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.

  Specifically, if this Class object represents a declared class, returns true if the specified Object argument is an instance of the represented class (or of any of its subclasses); false otherwise. If this Class object represents an array class, returns true if the specified Object argument can be converted to an object of the array type by an identity conversion or by a widening reference conversion; false otherwise. If this Class object represents an interface, returns true if the class or any superclass of the specified Object argument implements this interface; false otherwise. If this Class object represents a primitive type, returns false.

  Parameters:
    `obj` - The object to check

### isInterface

    public boolean isInterface()

  Determines if the specified Class object represents an interface type. true if this object represents an interface; false otherwise.

### isInterface

    public void isInterface(boolean isInterface)
                     throws SynthesisException

  Assert that the specified Class object represents an interface type. Can't be changed after real class loaded.
  Parameters:
    `true` - if this object represents an interface; false otherwise.
    `isInterface` -
  Throws:
    SynthesisException -

### isPrimitive

    public boolean isPrimitive()

  Determines if the specified Class object represents a primitive Java type.

  There are nine predefined Class objects to represent the eight primitive Java types and void. These are created by the Java Virtual Machine, 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 Class objects for which this method returns true.

### newInstance

    public java.lang.Object newInstance()
                                 throws java.lang.InstantiationException,
                                        java.lang.IllegalAccessException

  Creates a new instance of a class. a newly allocated instance of the class represented by this object. This is done exactly as if by a new expression with an empty argument list.
  Throws:
    java.lang.IllegalAccessException - if the class or initializer is not accessible.
    java.lang.InstantiationException - if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.

### 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 Class object represents a primitive type, returns the name of the primitive type.

  Should this say "synthetic" as well as "class" or "interface"? Or should that be gated on whether we're proxy to a realclass?

  Returns:
    a string representation of this class object.
  Overrides:
    toString in class java.lang.Object

### toSource

    public void toSource(java.io.OutputStream out,
                         int depth)

  Convenience for writing to, eg, System.out
  Parameters:
    `out` -
    `depth` -

### toSource

    public void toSource(java.io.PrintWriter out,
                         int depth)

  Converts the object to a Java code stream. The string representation is as full a Java definition of the class as we are able to achieve. If this Class object represents a primitive type, returns the name of the primitive type.
  Parameters:
    `out` -
    `depth` -

### modifierFromString

    public static int modifierFromString(java.lang.String t)

  Method modifierFromString
  Parameters:
    `t` - (modifierFromString) @return

### modifiersFromString

    public static int modifiersFromString(java.lang.String s)

  Method modifiersFromString
  Parameters:
    `s` - (modifiersFromString) @return

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 Apache XML Project. All Rights Reserved.