|
foundry-0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--foundry.classutils.ClassUtilities
A collection of methods useful for Class
es.
Constructor Summary | |
private |
ClassUtilities()
Constructs a new ClassUtilities object. |
Method Summary | |
static Set |
getAllFields(Class c)
Returns all Field s in the supplied Class and all
of its superclasses. |
static Set |
getAllFields(Class c,
Class stop)
Returns all Field s in the supplied Class and all
of its superclasses, up to but not including the superclass
identified by the stop parameter. |
static Set |
getAllFieldsWithReturnType(Class c,
Class type,
Class stop,
boolean excludeStatics)
Returns all Field s in the supplied Class (and all
of its superclasses up to but not including the superclass
identified by the stop parameter) that are of the
supplied data type. |
static URL |
getClasspathLocation(Class c)
Returns the classpath URL from which the supplied Class was loaded. |
private static URL |
getOfficialClasspathLocation(Class c)
Returns the classpath URL from which the supplied Class was loaded, as computed using ProtectionDomain s
and CodeSource s. |
static void |
main(String[] args)
Convenience method; allows use of the ClassUtilities
class as a program. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
private ClassUtilities()
ClassUtilities
object. Since all
publicly accessible methods in this class are
static
, this method should never be called.Method Detail |
private static final URL getOfficialClasspathLocation(Class c)
URL
from which the supplied Class
was loaded, as computed using ProtectionDomain
s
and CodeSource
s.c
- the Class
whose classpath location is to be
computednull
if the
official classpath location could not be computedpublic static final URL getClasspathLocation(Class c)
URL
from which the supplied Class
was loaded.c
- the Class
whose classpath location is to be computednull
if the
classpath location could not be determinedpublic static final Set getAllFields(Class c) throws SecurityException
Field
s in the supplied Class
and all
of its superclasses.c
- the Class
whose Field
s should be
returned; must not be null
Set
consisting of Field
objects in an
indeterminate orderSecurityException
- if the current SecurityManager
determines that reflection is not allowedClass.getFields()
,
Class.getDeclaredFields()
public static final Set getAllFields(Class c, Class stop) throws SecurityException
Field
s in the supplied Class
and all
of its superclasses, up to but not including the superclass
identified by the stop
parameter.c
- the Class
whose Field
s should be
returned; must not be null
stop
- the superclass whose Field
s (and whose
ancestors' Field
s) should not be included in the
return value; if null
then the entire superclass
chain will be examinedSet
consisting of Field
objects in an
indeterminate orderSecurityException
- if the current SecurityManager
determines that reflection is not allowedClass.getFields()
,
Class.getDeclaredFields()
public static final Set getAllFieldsWithReturnType(Class c, Class type, Class stop, boolean excludeStatics) throws SecurityException
Field
s in the supplied Class
(and all
of its superclasses up to but not including the superclass
identified by the stop
parameter) that are of the
supplied data type. Static fields can be excluded from the result.c
- the Class
whose Field
s should be
returned; must not be null
type
- the Class
of the data type that the data type
of all Field
s to be returned must be instances of; if
null
then no data type filtering will be performedstop
- the superclass whose Field
s (and whose
ancestors' Field
s) should not be included in the
return value; if null
then the entire superclass
chain will be examinedexcludeStatics
- exclude static Field
s from the
result if true
Set
consisting of Field
objects in an
indeterminate orderSecurityException
- if the current SecurityManager
determines that reflection is not allowedClass.getFields()
,
Class.getDeclaredFields()
public static final void main(String[] args) throws Exception
ClassUtilities
class as a program. For each class name supplied as an argument,
prints the classpath location from which that class was loaded.args
- the command line argumentsException
- if an error was encountered
|
foundry-0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |