sisc.modules.s2j
Class Util
java.lang.Object
sisc.util.Util
sisc.data.Expression
sisc.data.Value
sisc.data.Procedure
sisc.nativefun.NativeProcedure
sisc.nativefun.FixableProcedure
sisc.nativefun.IndexedFixableProcedure
sisc.modules.s2j.Util
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable, Immediate, NamedValue, ExpressionVisitee, Version
- Direct Known Subclasses:
- Conversion, Reflection
public abstract class Util
- extends IndexedFixableProcedure
- See Also:
- Serialized Form
Fields inherited from class sisc.util.Util |
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV |
Methods inherited from class sisc.data.Value |
displayNamedOpaque, equals, eqv, eval, express, getValue, synopsis, synopsis, toString, valueEqual, valueHashCode, write, writeReplace |
Methods inherited from class sisc.data.Expression |
deserializeAnnotations, getAnnotation, getAnnotation, getAnnotationKeys, getAnnotations, getName, readExternal, readResolve, serializeAnnotations, setAnnotation, setAnnotation, setName, visit, visitAnnotations, writeExternal |
Methods inherited from class sisc.util.Util |
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
S2JB
protected static final Symbol S2JB
Util
public Util()
Util
public Util(int id)
javaException
public static java.lang.Throwable javaException(SchemeException e)
jtype
public static final int jtype(Value o)
sjobj
public static final JavaObject sjobj(Value o)
jobj
public static final java.lang.Object jobj(Value o)
jclass
public static final java.lang.Class jclass(Value o)
jconstr
public static final java.lang.reflect.Constructor jconstr(Value o)
jmethod
public static final java.lang.reflect.Method jmethod(Value o)
jfield
public static final java.lang.reflect.Field jfield(Value o)
makeJObj
public static final JavaObject makeJObj(java.lang.Object o)
makeJObj
public static final JavaObject makeJObj(java.lang.Object o,
java.lang.Class c)
objArrayToVec
public static final Value objArrayToVec(java.lang.Object[] objs)
objectsToList
public static final Pair objectsToList(java.lang.Object[] objs)
pairToObjVect
public static java.util.Vector pairToObjVect(Pair p)
pairToObjects
public static final java.lang.Object[] pairToObjects(Pair p)
makeArrayClass
public static java.lang.Class makeArrayClass(java.lang.Class c,
int dims)
- Construct a class representing an array type for an array with
a certain component type and dimensions.
The Java reflection API offers no easy way of doing this, so
instead we have to create an array instance of the specific
type with zero-length dimensions and then get its class.
- Parameters:
c
- component type of the array typedims
- number of dimensions of the array type
- Returns:
- array type
resolvePrimitiveType
public static java.lang.Class resolvePrimitiveType(java.lang.String name)
- Map names of primitive types to their respective classes in
the reflection API.
- Parameters:
name
- primitive type name
- Returns:
- class corresponding to the primitive type, or
null
if the name was not recognized as that of a
primitive type
namePrimitiveType
public static java.lang.String namePrimitiveType(java.lang.Class c)
- Map a primitive type to it's name
- Parameters:
c
- primitive type class
- Returns:
- name corresponding to the primitive type, or
null
if the class was not recognized as that of a
primitive type
resolveType
public static java.lang.Class resolveType(java.lang.String name,
java.lang.ClassLoader cl)
throws java.io.IOException
- Map a type name to its corresponding class.
At the center of this is the Class.forName method. However,
that method cannot handle primitive types and array types
(actually it can, but one needs to use the VM-internal type
coding scheme), so we handle these case separately.
- Parameters:
name
- type namecl
- classloader to use
- Returns:
- a
Class
value
- Throws:
java.io.IOException
resolveType
public static java.lang.Class resolveType(java.lang.String name)
throws java.io.IOException
- Map a type name to its corresponding class.
This just calls
resolveType(name,
currentClassLoader())
.
- Throws:
java.io.IOException
nameType
public static java.lang.String nameType(java.lang.Class c)
- Map a class to its corresponding type name.
At the center of this is the Class.getName() method. However,
that method cannot handle primitive types and array types
(actually it can, but one needs to use the VM-internal type
coding scheme), so we handle these case separately.
- Parameters:
c
- class
- Returns:
- string naming the type
fixClass
public static java.lang.Class fixClass(java.lang.Class c)
- Map classes representing primitive types to their corresponding
java.lang
classes.
This is a hack so that we can pretend that primitive types are
assignable to their respective java.lang
classes
and visa versa.
- Parameters:
c
- class
- Returns:
- if
c
is a class representing a primitive
type then the corresponding java.lang
class is
returned, otherwise the original class.
mangleFieldName
public static java.lang.String mangleFieldName(java.lang.String s)
mangleMethodName
public static java.lang.String mangleMethodName(java.lang.String s)
mangleClassName
public static java.lang.String mangleClassName(java.lang.String s)