|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoscript.data.Value
oscript.data.Type
oscript.data.JavaClassWrapper
oscript.data.BuiltinType
public class BuiltinType
A BuiltinType
instance is used to represent a built-in type.
This is similar to JavaClassWrapper
, in that it allows a java
type to be sub-classed or instantiated, but it's difference is that it
restricts access. Because the Value
interface has dummy
methods for all the possible methods it's subclass may implement, we have
to do this to prevent the built-in types from appearing to have methods
that they don't have. For example:
var m = true.bopPlus;The
Value
dummy methods throw the appropriate exceptions
if you try and use a non-existant method, for example:
var v = true + false;To accomodate the possibility of things changing between when an object referencing this object is serialized, and when it is read back from a serial data stream (in a different invokation of the JVM), only the class- name is stored. The other paramters are loaded as via reflection as static fields of the named class:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class oscript.data.JavaClassWrapper |
---|
JavaClassWrapper.Base, JavaClassWrapper.Derived, JavaClassWrapper.JavaClassWrapperImpl |
Field Summary |
---|
Fields inherited from class oscript.data.JavaClassWrapper |
---|
impl, javaClass, MEMBER_NAMES, PARENT_TYPE_NAME, TYPE, TYPE_NAME, wrapperImpl |
Fields inherited from class oscript.data.Type |
---|
HIDDEN_TYPE |
Fields inherited from class oscript.data.Value |
---|
DEBUG, NULL, UNDEFINED |
Method Summary | |
---|---|
Value |
bopCast(Value val)
Perform the cast operation, (a)b is equivalent to a.bopCast(b) |
java.lang.String |
castToString()
Convert this object to a native java String value. |
protected java.lang.Object |
doConstruct(StackFrame sf,
MemberTable args,
boolean isWrapper)
Overloaded, because of how we handle args to the constructor. |
protected Value |
getTypeMember(Value obj,
int id)
Overloaded to hide "non-existant" methods. |
protected void |
init()
Initialize this object. |
boolean |
isA(Value type)
If this object is a type, determine if an instance of this type is an instance of the specified type, ie. |
static BuiltinType |
makeBuiltinType(java.lang.String className)
Get an instance of a built-in type. |
protected void |
populateMemberSet(java.util.Set s,
boolean debugger)
Derived classes that implement JavaClassWrapper.getMember(int, boolean) should also
implement this. |
protected void |
populateTypeMemberSet(java.util.Set s,
boolean debugger)
Derived classes that implement getTypeMember(oscript.data.Value, int) should also
implement this. |
Methods inherited from class oscript.data.JavaClassWrapper |
---|
callAsConstructor, callAsExtends, castToJavaObject, forName, getClassLoader, getClassWrapper, getClassWrapper, getMember, getName, getTypeImpl, getTypeMemberImpl |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static final BuiltinType makeBuiltinType(java.lang.String className)
className
- the name of the java class implementing the built-in type.protected void init()
JavaClassWrapper
impl
and wrapperImpl
are transient, and
might not exist if this object gets unserialized...
init
in class JavaClassWrapper
public boolean isA(Value type)
type
,
or a subclass.
isA
in class JavaClassWrapper
type
- the type to compare this type to
true
or false
PackagedScriptObjectException(NoSuchMemberException)
public java.lang.String castToString() throws PackagedScriptObjectException
String
value.
castToString
in class JavaClassWrapper
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException
public Value bopCast(Value val) throws PackagedScriptObjectException
(a)b
is equivalent to a.bopCast(b)
bopCast
in class Value
val
- the other value
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
protected Value getTypeMember(Value obj, int id)
getTypeMember
in class JavaClassWrapper
obj
- an object of this typeid
- the id of the symbol that maps to the member
Value.populateTypeMemberSet(java.util.Set, boolean)
protected java.lang.Object doConstruct(StackFrame sf, MemberTable args, boolean isWrapper)
doConstruct
in class JavaClassWrapper
protected void populateTypeMemberSet(java.util.Set s, boolean debugger)
getTypeMember(oscript.data.Value, int)
should also
implement this.
populateTypeMemberSet
in class JavaClassWrapper
s
- the set to populatedebugger
- true
if being used by debugger, in
which case both public and private/protected field names should
be returnedgetTypeMember(oscript.data.Value, int)
protected void populateMemberSet(java.util.Set s, boolean debugger)
JavaClassWrapper.getMember(int, boolean)
should also
implement this.
populateMemberSet
in class JavaClassWrapper
s
- the set to populatedebugger
- true
if being used by debugger, in
which case both public and private/protected field names should
be returnedJavaClassWrapper.getMember(int, boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |