|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.vub.at.objects.natives.NATNil
edu.vub.at.objects.natives.NATByRef
edu.vub.at.objects.natives.NATCallframe
edu.vub.at.objects.natives.NATObject
edu.vub.at.objects.symbiosis.JavaClass
A JavaClass instance represents a Java Class under symbiosis. Java classes are treated as AmbientTalk 'singleton' objects: - cloning a Java class results in the same Java class instance - sending 'new' to a Java class invokes the constructor and returns a new instance of the class under symbiosis - all static fields and methods of the Java class are reflected under symbiosis as fields and methods of the AT object A Java Class object that represents an interface can furthermore be used as an AmbientTalk stripe. The stripe's name corresponds to the interface's full name. JavaClass instances are pooled (on a per-actor basis): there should exist only one JavaClass instance for each Java class loaded into the JVM. Because the JVM ensures that a Java class can only be loaded once, we can use the Java class wrapped by the JavaClass instance as a unique key to identify its corresponding JavaClass instance.
| Field Summary | |
private static java.lang.ThreadLocal |
_JAVACLASS_POOL_
A thread-local hashmap pooling all of the JavaClass wrappers for the current actor, referring to them using SOFT references, such that unused wrappers can be GC-ed when running low on memory. |
private java.lang.Class |
wrappedClass_
|
| Fields inherited from class edu.vub.at.objects.natives.NATObject |
_EQL_NAME_, _INI_NAME_, _IS_A_, _NEW_NAME_, _NO_STRIPES_, _SHARES_A_, _SUPER_NAME_, stripes_ |
| Fields inherited from class edu.vub.at.objects.natives.NATCallframe |
customFields_, lexicalParent_, stateVector_, variableMap_ |
| Fields inherited from class edu.vub.at.objects.natives.NATNil |
_INSTANCE_ |
| Constructor Summary | |
private |
JavaClass(java.lang.Class wrappedClass)
A JavaClass wrapping a class c is an object that has the lexical scope as its lexical parent and has NIL as its dynamic parent. |
| Method Summary | |
JavaClass |
asJavaClassUnderSymbiosis()
|
ATTable |
base_getParentStripes()
If this class represents an interface type, parentStripes are wrappers for all interfaces extended by this Java interface type |
ATSymbol |
base_getStripeName()
|
ATBoolean |
base_isSubstripeOf(ATStripe other)
A Java interface type used as a stripe can only be a substripe of another Java interface type used as a stripe, and only if this type is assignable to the other type. |
boolean |
equals(java.lang.Object other)
By default, two AmbientTalk objects are equal if they are the same object, or one is a proxy for the same object. |
java.lang.Class |
getWrappedClass()
|
ATNil |
meta_addMethod(ATMethod method)
Methods can be added to a symbiotic Java class object provided they do not already exist in the Java class. |
ATNil |
meta_assignField(ATObject receiver,
ATSymbol name,
ATObject value)
Fields can be assigned within a symbiotic Java class object if that class has a mutable field with a matching name. |
ATNil |
meta_assignVariable(ATSymbol name,
ATObject value)
Variables can be assigned within a symbiotic Java class object if that class object has a mutable static field with a matching name. |
ATObject |
meta_clone()
Symbiotic Java class objects are singletons. |
ATNil |
meta_defineField(ATSymbol name,
ATObject value)
Fields can be defined within a symbiotic Java class object. |
ATField |
meta_grabField(ATSymbol fieldName)
Fields can be grabbed from a symbiotic Java class object. |
ATMethod |
meta_grabMethod(ATSymbol methodName)
Methods can be grabbed from a symbiotic Java class object. |
ATObject |
meta_invoke(ATObject receiver,
ATSymbol atSelector,
ATTable arguments)
When a method is invoked upon a symbiotic Java class object, the underlying static Java method with the same name as the AmbientTalk selector is invoked. |
ATBoolean |
meta_isCloneOf(ATObject original)
Detects whether this object an the passed parameter are the result of cloning from a common ancestor (possibly either one of the objects itself). |
ATTable |
meta_listFields()
Querying a symbiotic Java class object for its fields results in a table containing both 'native' static Java fields and the fields of its AT symbiont |
ATTable |
meta_listMethods()
Querying a symbiotic Java class object for its methods results in a table containing both 'native' static Java methods and the methods of its AT symbiont |
ATObject |
meta_lookup(ATSymbol selector)
A variable lookup is resolved by first checking whether the Java object has an appropriate static field with a matching name. |
ATObject |
meta_newInstance(ATTable initargs)
aJavaClass.new(@args) == invoke a Java constructor AmbientTalk objects can add a custom new method to the class in order to intercept instance creation. |
NATText |
meta_print()
Prints out the object in a human-readable way. |
ATObject |
meta_resolve()
A Java Class object remains unique within an actor. |
ATBoolean |
meta_respondsTo(ATSymbol atSelector)
A symbiotic Java class object responds to all of the public static selectors of its Java class plus all of the per-instance selectors added to its AmbientTalk symbiont. |
ATObject |
meta_select(ATObject receiver,
ATSymbol selector)
When selecting a field from a symbiotic Java class object, if the object's class has a static field with a matching selector, it is automatically read; if it has methods corresponding to the selector, they are returned in a JavaMethod wrapper, otherwise, the fields of its AT symbiont are checked. |
static JavaClass |
wrapperFor(java.lang.Class c)
|
| Methods inherited from class edu.vub.at.objects.natives.NATCallframe |
getLocalCustomField, getLocalField, hasLocalCustomField, hasLocalField, hasLocalNativeField, meta_addField, meta_doesNotUnderstand, meta_getDynamicParent, meta_getLexicalParent, setLocalField |
| Methods inherited from class edu.vub.at.objects.natives.NATNil |
asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeFraction, asNativeNumber, asNativeNumeric, asNativeTable, asNativeText, base__opeql__opeql_, base_asFarReference, base_asVariableAssignment, base_init, base_isFarReference, base_isMessageCreation, base_isVariableAssignment, base_new, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText, meta_eval, meta_quote, meta_receive, meta_send, readResolve, toString, writeReplace |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.vub.at.objects.ATObject |
base__opeql__opeql_, base_init, base_new, meta_addField, meta_doesNotUnderstand, meta_eval, meta_extend, meta_getDynamicParent, meta_getLexicalParent, meta_getStripes, meta_isRelatedTo, meta_isStripedWith, meta_pass, meta_quote, meta_receive, meta_send, meta_share |
| Field Detail |
private static final java.lang.ThreadLocal _JAVACLASS_POOL_
private final java.lang.Class wrappedClass_
| Constructor Detail |
private JavaClass(java.lang.Class wrappedClass)
| Method Detail |
public static final JavaClass wrapperFor(java.lang.Class c)
public java.lang.Class getWrappedClass()
public JavaClass asJavaClassUnderSymbiosis()
throws XTypeMismatch
asJavaClassUnderSymbiosis in interface ATConversionsasJavaClassUnderSymbiosis in class NATNilXTypeMismatchpublic boolean equals(java.lang.Object other)
NATNil
equals in class NATNil
public ATObject meta_invoke(ATObject receiver,
ATSymbol atSelector,
ATTable arguments)
throws InterpreterException
meta_invoke in interface ATObjectmeta_invoke in class NATObjectInterpreterException
public ATBoolean meta_respondsTo(ATSymbol atSelector)
throws InterpreterException
meta_respondsTo in interface ATObjectmeta_respondsTo in class NATObjectInterpreterException
public ATObject meta_select(ATObject receiver,
ATSymbol selector)
throws InterpreterException
meta_select in interface ATObjectmeta_select in class NATObjectreceiver - the original receiver of the selectionselector - the selector to look up
InterpreterException
public ATObject meta_lookup(ATSymbol selector)
throws InterpreterException
meta_lookup in interface ATObjectmeta_lookup in class NATObjectInterpreterException
public ATNil meta_defineField(ATSymbol name,
ATObject value)
throws InterpreterException
meta_defineField in interface ATObjectmeta_defineField in class NATObjectInterpreterException
public ATNil meta_assignVariable(ATSymbol name,
ATObject value)
throws InterpreterException
meta_assignVariable in interface ATObjectmeta_assignVariable in class NATCallframeInterpreterException
public ATNil meta_assignField(ATObject receiver,
ATSymbol name,
ATObject value)
throws InterpreterException
meta_assignField in interface ATObjectmeta_assignField in class NATObjectvalue - the value to assign to the fieldname - the field to assign
InterpreterException
public ATObject meta_clone()
throws InterpreterException
meta_clone in interface ATObjectmeta_clone in class NATObjectInterpreterException
public ATObject meta_newInstance(ATTable initargs)
throws InterpreterException
meta_newInstance in interface ATObjectmeta_newInstance in class NATObjectInterpreterException
public ATNil meta_addMethod(ATMethod method)
throws InterpreterException
meta_addMethod in interface ATObjectmeta_addMethod in class NATObjectInterpreterException
public ATField meta_grabField(ATSymbol fieldName)
throws InterpreterException
meta_grabField in interface ATObjectmeta_grabField in class NATCallframeInterpreterException
public ATMethod meta_grabMethod(ATSymbol methodName)
throws InterpreterException
meta_grabMethod in interface ATObjectmeta_grabMethod in class NATObjectInterpreterException
public ATTable meta_listFields()
throws InterpreterException
meta_listFields in interface ATObjectmeta_listFields in class NATCallframeInterpreterException
public ATTable meta_listMethods()
throws InterpreterException
meta_listMethods in interface ATObjectmeta_listMethods in class NATObjectInterpreterException
public ATBoolean meta_isCloneOf(ATObject original)
throws InterpreterException
ATObject
meta_isCloneOf in interface ATObjectmeta_isCloneOf in class NATObjectInterpreterException
public NATText meta_print()
throws InterpreterException
ATObject
meta_print in interface ATObjectmeta_print in class NATObjectInterpreterException
public ATObject meta_resolve()
throws InterpreterException
meta_resolve in interface ATObjectmeta_resolve in class NATObjectInterpreterException
public ATTable base_getParentStripes()
throws InterpreterException
base_getParentStripes in interface ATStripeInterpreterException
public ATSymbol base_getStripeName()
throws InterpreterException
base_getStripeName in interface ATStripeInterpreterException
public ATBoolean base_isSubstripeOf(ATStripe other)
throws InterpreterException
base_isSubstripeOf in interface ATStripeInterpreterException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||