@Deprecated public class ReflectedUniverse extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
force
Deprecated.
Whether to force our way past restrictive access modifiers.
|
protected ClassLoader |
loader
Deprecated.
Class loader for imported classes.
|
protected HashMap<String,Object> |
variables
Deprecated.
Hashtable containing all variables present in the universe.
|
Constructor and Description |
---|
ReflectedUniverse()
Deprecated.
Constructs a new reflected universe.
|
ReflectedUniverse(ClassLoader loader)
Deprecated.
Constructs a new reflected universe that uses the given class loader.
|
ReflectedUniverse(URL[] urls)
Deprecated.
Constructs a new reflected universe, with the given URLs
representing additional search paths for imported classes
(in addition to the CLASSPATH).
|
Modifier and Type | Method and Description |
---|---|
Object |
exec(String command)
Deprecated.
Executes a command in the universe.
|
Object |
getVar(String varName)
Deprecated.
Returns the value of a variable or field in the universe.
|
boolean |
isAccessibilityIgnored()
Deprecated.
Gets whether access modifiers (protected, private, etc.) are ignored.
|
static boolean |
isInstance(Class<?> c,
Object o)
Deprecated.
Returns whether the given object is compatible with the
specified class for the purposes of reflection.
|
static void |
main(String[] args)
Deprecated.
Allows exploration of a reflected universe in an interactive environment.
|
void |
setAccessibilityIgnored(boolean ignore)
Deprecated.
Sets whether access modifiers (protected, private, etc.) are ignored.
|
void |
setVar(String varName,
boolean b)
Deprecated.
Registers a variable of primitive type boolean in the universe.
|
void |
setVar(String varName,
byte b)
Deprecated.
Registers a variable of primitive type byte in the universe.
|
void |
setVar(String varName,
char c)
Deprecated.
Registers a variable of primitive type char in the universe.
|
void |
setVar(String varName,
double d)
Deprecated.
Registers a variable of primitive type double in the universe.
|
void |
setVar(String varName,
float f)
Deprecated.
Registers a variable of primitive type float in the universe.
|
void |
setVar(String varName,
int i)
Deprecated.
Registers a variable of primitive type int in the universe.
|
void |
setVar(String varName,
long l)
Deprecated.
Registers a variable of primitive type long in the universe.
|
void |
setVar(String varName,
Object obj)
Deprecated.
Registers a variable in the universe.
|
void |
setVar(String varName,
short s)
Deprecated.
Registers a variable of primitive type short in the universe.
|
protected HashMap<String,Object> variables
protected ClassLoader loader
protected boolean force
public ReflectedUniverse()
public ReflectedUniverse(URL[] urls)
urls
- array of URLs to search for additional classes.
Each URL is typically a JAR file that is not on
the CLASSPATH.public ReflectedUniverse(ClassLoader loader)
loader
- the ClassLoader to use in this universe.
If null, the default ClassLoader for the ReflectedUniverse
class will be used.public static boolean isInstance(Class<?> c, Object o)
c
- the base classo
- the object that needs type checkingpublic Object exec(String command) throws ReflectException
command
- the command to be executed (see examples above)ReflectException
- if the command is invalid or fails to executepublic void setVar(String varName, Object obj)
varName
- the name of the variable to assignobj
- the value to assign to the variablepublic void setVar(String varName, boolean b)
varName
- the name of the variable to assignb
- the boolean value to assign to the variablepublic void setVar(String varName, byte b)
varName
- the name of the variable to assignb
- the byte value to assign to the variablepublic void setVar(String varName, char c)
varName
- the name of the variable to assignc
- the char value to assign to the variablepublic void setVar(String varName, double d)
varName
- the name of the variable to assignd
- the double value to assign to the variablepublic void setVar(String varName, float f)
varName
- the name of the variable to assignf
- the float value to assign to the variablepublic void setVar(String varName, int i)
varName
- the name of the variable to assigni
- the int value to assign to the variablepublic void setVar(String varName, long l)
varName
- the name of the variable to assignl
- the long value to assign to the variablepublic void setVar(String varName, short s)
varName
- the name of the variable to assigns
- the short value to assign to the variablepublic Object getVar(String varName) throws ReflectException
varName
- the name of the variable to retrieveReflectException
- if the variable name or value is invalidpublic void setAccessibilityIgnored(boolean ignore)
ignore
- true if access modifiers should be ignoredpublic boolean isAccessibilityIgnored()
public static void main(String[] args) throws IOException
args
- if non-empty, access modifiers will be ignoredIOException
- if there is an error reading from stdinCopyright © 2005–2019 Open Microscopy Environment. All rights reserved.