org.apache.velocity.tools.generic
Class ClassTool

This tool is meant to simplify reflective lookup of information about
a Class and its Fields, Methods, and Constructors.
This is ideally aimed at those wishing to generate documentation, demo code, or
other content based on runtime reflection of a specified Class or Classes. It was not
designed with reflective execution of code in mind and thus provides no facilities
for code execution, nor direct access to the actual methods, constructors or fields
of the class being inspected.

getShowDeprecated

getType

inspect

Returns a new ClassTool instance that is inspecting the
Class with the specified name. If the specified Class cannot
be found, then this will return null. All other
configuration settings will be copied to the new instance.

inspect

Returns a new ClassTool instance that is inspecting the
Class of the specified Object. If the specified object
is null, then this will return null. All other
configuration settings will be copied to the new instance.

getSuper

Returns a new ClassTool instance that is inspecting the
superclass of the Class being inspected by this instance.
If the current inspectee has no super class,
then this will return null. All other
configuration settings will be copied to the new instance.

inspect

Returns a new ClassTool instance that is inspecting the
the specified Class. If the specified class
is null, then this will return null. All other
configuration settings will be copied to the new instance.
If SafeConfig.isSafeMode() is true and the specified Class
is not declared public, then this will return
null.

getFullName

supportsNewInstance

public boolean supportsNewInstance()

Returns true if a call to newInstance() on the Class being
inspected is successful; otherwise returns false. Unlike calling
newInstance() directly from a template, this will not throw an
Exception if it fails, as all Exceptions are caught.

isDeprecated

public boolean isDeprecated()

Returns true if the inspected Class has been deprecated.

isPublic

public boolean isPublic()

Returns true if the inspected Class is declared public.

isProtected

public boolean isProtected()

Returns true if the inspected Class is declared protected.

isPrivate

public boolean isPrivate()

Returns true if the inspected Class is declared private.

isStatic

public boolean isStatic()

Returns true if the inspected Class is an inner class
that has been declared static or is a standard outer class..

isAbstract

getMethods

Returns a List of ClassTool.MethodSubs for each
method declared method in the inspected class. However,
in safe mode (which *is* the default), this will only return
the public methods. You must configure safe mode to be off
to receive a list of all methods.

getConstructors

Returns a List of ClassTool.ConstructorSubs for each
constructor declared constructor in the inspected class. However,
in safe mode (which *is* the default), this will only return
the public constructors. You must configure safe mode to be off
to receive a list of all constructors.

getFields

Returns a List of ClassTool.FieldSubs for each
field declared field in the inspected class. However,
in safe mode (which *is* the default), this will only return
the public fields. You must configure safe mode to be off
to receive a list of all fields.