org.omegahat.R.Java
Class RForeignReference
java.lang.Object
|
+--org.omegahat.Interfaces.NativeInterface.ForeignReference
|
+--org.omegahat.R.Java.RForeignReference
- All Implemented Interfaces:
- ForeignReferenceInt
- Direct Known Subclasses:
- REvaluator, RManualFunctionActionListener
- public class RForeignReference
- extends ForeignReference
This is the main class for an representing an S object in Java,
where the S object is not copied to Java but stored within S
and accessed in Java via this "proxy" reference.
It is the base class for representing a Foreign Reference
after it has been converted from a
ForeignReference
This instantiation occurs when the ForeignReference
is evaluated, and potentially a new class is generated. Then an object of the necessary
type that is derived from this class is created.
|
Method Summary |
java.lang.Object |
localEval(org.omegahat.Environment.Parser.Parse.List args,
java.lang.String methodName,
java.lang.String returnClass,
java.lang.String[] jsignature)
The method that performs the call back to R to invoke the method named
methodName on the object identified by this objects
reference identifier (getReferenceName()). |
java.lang.Object |
reval(java.lang.String id,
java.lang.Object[] args,
java.lang.String methodName,
java.lang.String returnClass,
java.lang.String[] jsignature)
Native method that invokes the "method" identified by methodName
on the underlying S object (usually a closure), passing it the arguments
given in the array args. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RForeignReference
public RForeignReference(java.lang.String id)
- Create a reference with the specified name.
RForeignReference
public RForeignReference(java.lang.String id,
OmegaInterfaceManager evaluator)
- Create a reference with the specified identifier/name an
register that its Omegahat evaluator is the given here.
This is useful when there is more than one Omegahat
evaluator and we want the methods of this reference to be
evaluated within this Omegahat interpreter.
RForeignReference
public RForeignReference(ForeignReference id)
RForeignReference
public RForeignReference(ForeignReference id,
OmegaInterfaceManager evaluator)
localEval
public java.lang.Object localEval(org.omegahat.Environment.Parser.Parse.List args,
java.lang.String methodName,
java.lang.String returnClass,
java.lang.String[] jsignature)
throws java.lang.Exception
- The method that performs the call back to R to invoke the method named
methodName on the object identified by this objects
reference identifier (getReferenceName()).
This then attempts to convert the answer R gave us to the one required by
the method call that invoked this using
convertResult.
reval
public java.lang.Object reval(java.lang.String id,
java.lang.Object[] args,
java.lang.String methodName,
java.lang.String returnClass,
java.lang.String[] jsignature)
- Native method that invokes the "method" identified by
methodName
on the underlying S object (usually a closure), passing it the arguments
given in the array args.
This is usually called as the single entry point that allows Java to
invoke methods in an object that is actually stored in S.
So within a single Java class that is a reference to an S object,
we may have multiple (possibly overloaded) methods and
we implement each of these via a call to reval().
These pass their own signature with which they are defined,
including the types of the arguments and the return type.
Usually, these classes and their methods are generated
programmatically via the byte-code compiler provided by
Omegahat, ForeignReferenceClassGenerator.
- Parameters:
the - identifier for this reference objectargs - the array of arguments to pass to the S methodmethodName - the name of the "method" within the S object to
invokereturnClass - the name of the return type expected.