public final class JavaObject extends LispObject
Modifier and Type | Field and Description |
---|---|
private static Primitive |
_FIND_JAVA_CLASS |
private static Primitive |
_REGISTER_JAVA_CLASS |
private static Primitive |
DESCRIBE_JAVA_OBJECT |
static Symbol |
ENSURE_JAVA_CLASS |
private Class<?> |
intendedClass |
static Symbol |
JAVA_CLASS |
static Symbol |
JAVA_CLASS_JCLASS |
private static Map<Class<?>,LispObject> |
javaClassMap |
(package private) Object |
obj |
Constructor and Description |
---|
JavaObject(Object obj) |
JavaObject(Object obj,
Class<?> intendedClass)
Constructs a Java Object with the given intended class, used to access
the object reflectively.
|
Modifier and Type | Method and Description |
---|---|
LispObject |
classOf() |
static String |
describeJavaObject(JavaObject javaObject) |
static void |
doClassHierarchy(Class<?> clss,
LispObject callback)
Executes a function recursively over
|
private static void |
doClassHierarchy(Collection<Class<?>> classes,
LispObject callback,
Set<Class<?>> visited)
Executes a function repeatedly over the minimal subtree of the
Java class hierarchy which contains every class in
|
boolean |
equal(LispObject other) |
boolean |
equalp(LispObject other) |
static LispObject |
findJavaClass(Class<?> javaClass) |
LispObject |
getDescription() |
private LispObject |
getInspectedFields() |
static LispObject |
getInstance(Object obj)
Encapsulates obj, if required.
|
static LispObject |
getInstance(Object obj,
boolean translated)
Encapsulates obj, if required.
|
static LispObject |
getInstance(Object obj,
boolean translated,
Class<?> intendedClass)
Encapsulates obj, if required.
|
static LispObject |
getInstance(Object obj,
Class<?> intendedClass)
Encapsulates obj, if required.
|
Class<?> |
getIntendedClass() |
Object |
getObject() |
static Object |
getObject(LispObject o) |
LispObject |
getParts()
Implementing the getParts() protocol will allow INSPECT to
return information about the substructure of a descendent of
LispObject.
|
Object |
javaInstance() |
Object |
javaInstance(Class<?> c) |
Object |
lockableInstance()
Returns the encapsulated Java object for
interoperability with wait, notify, synchronized, etc.
|
static LispObject |
mapcarClassHierarchy(Class<?> clss,
LispObject fn) |
static LispObject |
registerJavaClass(Class<?> javaClass,
LispObject classMetaObject) |
LispObject |
STRING() |
int |
sxhash() |
LispObject |
typeOf() |
LispObject |
typep(LispObject type) |
String |
writeToString() |
ABS, add, add, aref_long, aref, AREF, AREF, aset, aset, aset, ash, ash, atom, ATOM, caddr, cadr, car, cddr, cdr, CHAR, characterp, CHARACTERP, chars, COMPLEXP, constantp, CONSTANTP, copyToArray, decr, DENOMINATOR, dispatch, divideBy, doubleValue, elt, endp, ENDP, EQ, eql, eql, eql, EQL, equal, EQUAL, equalp, evenp, EVENP, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, floatp, FLOATP, floatValue, getBooleanValue, getCallCount, getDocumentation, getFixnumSlotValue, getHotCount, getInstance, getPropertyList, getSlotValue_0, getSlotValue_1, getSlotValue_2, getSlotValue_3, getSlotValue, getSlotValueAsBoolean, getStringChars, getStringValue, getSymbolFunction, getSymbolFunctionOrDie, getSymbolSetfFunction, getSymbolSetfFunctionOrDie, getSymbolValue, incr, incrementCallCount, incrementHotCount, integerp, INTEGERP, intValue, IS_E, IS_GE, IS_GT, IS_LE, IS_LT, IS_NE, isEqualTo, isEqualTo, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNotEqualTo, isNotEqualTo, isSpecialOperator, isSpecialVariable, LDB, length, LENGTH, listp, LISTP, LOGAND, LOGAND, LOGIOR, LOGIOR, LOGNOT, LOGXOR, LOGXOR, longValue, minusp, MINUSP, MOD, MOD, multiplyBy, multiplyBy, negate, noFillPointer, NOT, nreverse, NTH, NTH, nthcdr, numberp, NUMBERP, NUMERATOR, oddp, ODDP, plusp, PLUSP, psxhash, psxhash, push, rationalp, RATIONALP, realp, REALP, resolve, reverse, RPLACA, RPLACD, SCHAR, setCallCount, setCar, setCdr, setDocumentation, setHotCount, setPropertyList, setSlotValue_0, setSlotValue_1, setSlotValue_2, setSlotValue_3, setSlotValue, setSlotValue, SIMPLE_STRING_P, SLOT_VALUE, stringp, STRINGP, subtract, subtract, SVREF, svset, SYMBOLP, truncate, unreadableString, unreadableString, unreadableString, unreadableString, VECTOR_PUSH_EXTEND, VECTOR_PUSH_EXTEND, vectorp, VECTORP, vectorPushExtend, zerop, ZEROP
final Object obj
private final Class<?> intendedClass
public static final Symbol JAVA_CLASS_JCLASS
public static final Symbol JAVA_CLASS
public static final Symbol ENSURE_JAVA_CLASS
private static final Primitive DESCRIBE_JAVA_OBJECT
private static final Map<Class<?>,LispObject> javaClassMap
private static final Primitive _FIND_JAVA_CLASS
private static final Primitive _REGISTER_JAVA_CLASS
public JavaObject(Object obj)
public JavaObject(Object obj, Class<?> intendedClass)
ClassCastException
- if the object is not an instance of the
intended class.public LispObject typeOf()
typeOf
in class LispObject
public LispObject classOf()
classOf
in class LispObject
public LispObject typep(LispObject type)
typep
in class LispObject
public LispObject STRING()
STRING
in class LispObject
public final Object getObject()
public static final LispObject getInstance(Object obj)
LispObject
, it's returned as-is.obj
- Any java objectpublic static final LispObject getInstance(Object obj, Class<?> intendedClass)
LispObject
, it's returned as-is.
If not, a java object with the specified intended class is returned.obj
- Any java objectintendedClass
- the class that shall be used to access objpublic static final LispObject getInstance(Object obj, boolean translated)
LispObject
, it's returned as-is.
If obj is of a type which can be mapped to a lisp type,
an object of the mapped type is returned, if translated is true.obj
- translated
- public static final LispObject getInstance(Object obj, boolean translated, Class<?> intendedClass)
LispObject
, it's returned as-is.
If obj is of a type which can be mapped to a lisp type,
an object of the mapped type is returned, if translated is true.obj
- translated
- intendedClass
- the class that shall be used to reflectively
access obj; it is an error for obj not to be
an instance of this class. This parameter is ignored
if translated == true and the object can be
converted to a Lisp object.public Object javaInstance()
javaInstance
in class LispObject
public Object javaInstance(Class<?> c)
javaInstance
in class LispObject
public Object lockableInstance()
lockableInstance
in class LispObject
public Class<?> getIntendedClass()
public static final Object getObject(LispObject o)
public final boolean equal(LispObject other)
equal
in class LispObject
public final boolean equalp(LispObject other)
equalp
in class LispObject
public int sxhash()
sxhash
in class LispObject
public String writeToString()
writeToString
in class LispObject
public LispObject getDescription()
getDescription
in class LispObject
public LispObject getParts()
LispObject
getParts
in class LispObject
private LispObject getInspectedFields()
private static void doClassHierarchy(Collection<Class<?>> classes, LispObject callback, Set<Class<?>> visited)
public static void doClassHierarchy(Class<?> clss, LispObject callback)
public static LispObject mapcarClassHierarchy(Class<?> clss, LispObject fn)
public static String describeJavaObject(JavaObject javaObject)
public static LispObject registerJavaClass(Class<?> javaClass, LispObject classMetaObject)
public static LispObject findJavaClass(Class<?> javaClass)