|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.prim.E
Safe: This class is most of the normal application programmer's API to the ELib functionality. In particular, the send methods below are what E's "<-" turn into.
NOTE! All the methods of this class trust their callers to 1) only provide interned strings as verbs, and 2) not modify an args array after passing it in. Btw, all source code literal strings are automatically intern()ed. ELib itself will never modify a passed-in args array.
This class is not intended to be used directly from E-language programs. Rather, the name "E" in the safe scope contains a thin wrapper for this class for the E language programmer to use instead.
Field Summary | |
private static boolean |
Backtracing
XXX SECURITY ALERT: This is a semantically visible mutable static variable, used to suppress infinite regress when the attempt to generate a meaningful backtrace string results in another exception that needs to be backtraced. |
static Object[] |
NO_ARGS
Enabled: |
Constructor Summary | |
private |
E()
prevent instantiation |
Method Summary | |
private static void |
abbrev(StringBuffer buf,
String str,
int[] budget)
To make the backtrace be pretty |
static Object |
as(Object specimen,
Class targType)
Enabled: These are E's implicit coercions to Java Class types, using Java's (not E's) null and non-near acceptance behavior. |
static Object |
as(Object specimen,
Class targType,
OneArgFunc optEjector)
Enabled: |
static boolean |
asBoolean(Object specimen)
Enabled: As a "boolean" scalar. |
static char |
asChar(Object specimen)
Enabled: As a "char" scalar |
static double |
asFloat64(Object specimen)
Enabled: As a "double" scalar |
static int |
asInt(Object specimen)
Enabled: As an "int" scalar |
static RuntimeException |
asRTE(Object problem)
Enabled: As a RuntimeException |
static RuntimeException |
backtrace(Throwable ex,
Object rec,
String verb,
Object[] args)
Enabled: Return 'ex' annotated with a compact description of 'rec.verb(args)'. |
static Object |
call(Object rec,
String verb)
Enabled: A 0-argument immediate call |
static Object |
call(Object rec,
String verb,
Object arg1)
Enabled: A 1-argument immediate call |
static Object |
call(Object rec,
String verb,
Object arg1,
Object arg2)
Enabled: A 2-argument immediate call |
static Object |
call(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
Enabled: A 3-argument immediate call |
static Object |
call(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Enabled: A 4-argument immediate call |
static Object |
callAll(Object rec,
String verb,
Object[] args)
Enabled: An E immediate call -- ask 'rec' to immediately do the request described by 'verb' using the supplied 'args'. |
static void |
require(boolean cond)
Enabled: 'problem' defaults to "required condition failed" |
static void |
require(boolean cond,
Object problem)
Enabled: If cond isn't true, report problem or problem(). |
static Ref |
send(Object rec,
String verb)
Enabled: A 0-argument eventual send |
static Ref |
send(Object rec,
String verb,
Object arg1)
Enabled: A 1-argument eventual send |
static Ref |
send(Object rec,
String verb,
Object arg1,
Object arg2)
Enabled: A 2-argument eventual send |
static Ref |
send(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
Enabled: A 3-argument eventual send |
static Ref |
send(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Enabled: A 4-argument eventual send |
static Ref |
sendAll(Object rec,
String verb,
Object[] args)
Enabled: Queue the described delivery. |
static Throwable |
sendAllOnly(Object rec,
String verb,
Object[] args)
Enabled: Like sendAll(rec, verb, args), except that "Only" means we don't care about the result (including whether it succeeded), as is appropriate for event notifications. |
static Throwable |
sendOnly(Object rec,
String verb)
Enabled: A 0-argument eventual sendOnly |
static Throwable |
sendOnly(Object rec,
String verb,
Object arg1)
Enabled: A 1-argument eventual sendOnly |
static Throwable |
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2)
Enabled: A 2-argument eventual sendOnly |
static Throwable |
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
Enabled: A 3-argument eventual sendOnly |
static Throwable |
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Enabled: A 4-argument eventual sendOnly |
static Twine |
toQuote(Object obj)
Enabled: Like toTwine, but gets the quoted form. |
static String |
toString(Object obj)
Enabled: Like E.toTwine(obj), but returns a String. |
static Twine |
toTwine(Object obj)
Enabled: Prints obj into a Twine if necessary, and returns this printed form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Object[] NO_ARGS
private static boolean Backtracing
This is a rare case of something I don't know how to do as well in a pure capability pattern.
Constructor Detail |
private E()
Method Detail |
public static Object call(Object rec, String verb)
callAll(Object, String, Object[])
public static Object call(Object rec, String verb, Object arg1)
callAll(Object, String, Object[])
public static Object call(Object rec, String verb, Object arg1, Object arg2)
callAll(Object, String, Object[])
public static Object call(Object rec, String verb, Object arg1, Object arg2, Object arg3)
callAll(Object, String, Object[])
public static Object call(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
callAll(Object, String, Object[])
public static Object callAll(Object rec, String verb, Object[] args)
private static void abbrev(StringBuffer buf, String str, int[] budget)
public static RuntimeException backtrace(Throwable ex, Object rec, String verb, Object[] args)
public static Ref send(Object rec, String verb)
sendAll(Object, String, Object[])
public static Ref send(Object rec, String verb, Object arg1)
sendAll(Object, String, Object[])
public static Ref send(Object rec, String verb, Object arg1, Object arg2)
sendAll(Object, String, Object[])
public static Ref send(Object rec, String verb, Object arg1, Object arg2, Object arg3)
sendAll(Object, String, Object[])
public static Ref send(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
sendAll(Object, String, Object[])
public static Ref sendAll(Object rec, String verb, Object[] args)
Rather than providing an explicit Resolver as input argument, this method returns a promise that represents the outcome. When the actual outcome is determined, the returned reference will reflect that outcome.
This should only synchronously throw an exception if invoked while there's no current Vat.
public static Throwable sendOnly(Object rec, String verb)
sendAllOnly(Object, String, Object[])
public static Throwable sendOnly(Object rec, String verb, Object arg1)
sendAllOnly(Object, String, Object[])
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2)
sendAllOnly(Object, String, Object[])
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2, Object arg3)
sendAllOnly(Object, String, Object[])
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
sendAllOnly(Object, String, Object[])
public static Throwable sendAllOnly(Object rec, String verb, Object[] args)
public static String toString(Object obj)
public static Twine toTwine(Object obj)
E programmers should generally call "E.toTwine(obj)", rather than "obj.toString()". This applies both to E language programmers and to ELib programmers. However, E programmers should not generally call E.toTwine(obj) from within __printOn(TextWriter) methods, as that will circumvent the cycle-breaking logic in TextWriter. Instead, you should usually call a TextWriter.*print*(obj) method, as it will check for a cycle before calling __printOn(TextWriter) on its argument.
public static Twine toQuote(Object obj)
org.erights.e.elib.oldeio.TextWriter#quote
public static Object as(Object specimen, Class targType)
Given that specimen is NEAR, when targType isPrimitive(), then
E.as(specimen, targType)is like
targType.coerce(specimen, null)Otherwise
E.as(specimen, targType)is like
nullOk(targType).coerce(specimen, null)If specimen is not near and targType isn't a rubber stamping interface, then either of the above coerce calls will fail, but E.as will succeed if the specimen is a Java-instanceof the targType.
public static Object as(Object specimen, Class targType, OneArgFunc optEjector)
public static boolean asBoolean(Object specimen)
public static int asInt(Object specimen)
public static double asFloat64(Object specimen)
public static char asChar(Object specimen)
public static RuntimeException asRTE(Object problem)
public static void require(boolean cond)
public static void require(boolean cond, Object problem)
If problem coerces to a Thunk, then reassign problem to be the result of calling this thunk with 'run()'. Then, in either case, coerce this problem to a RuntimeException and throw it.
This is used by the implementation of the 'require' function in the E language's universal scope.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |