|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bsh.Name
What's in a name? I'll tell you... Name() is a somewhat ambiguous thing in the grammar and so is this.
This class is a name resolver. It holds a possibly ambiguous dot separated name and reference to a namespace in which it allegedly lives. It provides methods that attempt to resolve the name to various types of entities: e.g. an Object, a Class, a localy declared bsh method.
implementing *** Name objects are not to be constructed arbitrarily, but are to be factoried by NameSpace.getNameResolver, which caches them subject to a namespace change. This means that we can cache information about various types of resolution here.
Nested Class Summary | |
(package private) static class |
Name.ClassIdentifier
|
Field Summary | |
private int |
callstackDepth
|
private java.lang.Object |
evalBaseObject
|
private java.lang.String |
evalName
|
private boolean |
literalCallerReference
The last round consume the literal 'caller' reference (not super, global, or another This type var). |
private boolean |
literalThisReference
The last round consume the literal 'this' reference (not super, global, or another This type var). |
NameSpace |
namespace
|
(package private) java.lang.String |
value
|
Constructor Summary | |
Name(NameSpace namespace,
java.lang.String s)
This constructor should *not* be used in general. |
Method Summary | |
private java.lang.Object |
consumeNextObjectField(CallStack callstack,
Interpreter interpreter,
boolean forceClass)
Get next prefixed object field component |
(package private) static int |
countParts(java.lang.String value)
|
java.lang.Object |
invokeLocalMethod(Interpreter interpreter,
java.lang.Object[] args,
CallStack callstack,
SimpleNode callerInfo)
Invoke a locally declared method or a bsh command. |
java.lang.Object |
invokeMethod(Interpreter interpreter,
java.lang.Object[] args,
CallStack callstack,
SimpleNode callerInfo)
Invoke the method identified by name. |
(package private) static boolean |
isCompound(java.lang.String value)
|
(package private) static java.lang.String |
prefix(java.lang.String value)
|
(package private) static java.lang.String |
prefix(java.lang.String value,
int parts)
|
private void |
reset()
|
(package private) java.lang.Object |
resolveThisFieldReference(CallStack callstack,
NameSpace thisNamespace,
Interpreter interpreter,
java.lang.String varName,
boolean specialFieldsVisible)
Resolve a variable relative to a This reference. |
(package private) static java.lang.String |
suffix(java.lang.String name)
|
static java.lang.String |
suffix(java.lang.String value,
int parts)
|
java.lang.Class |
toClass()
Check the cache, else use toObject() to try to resolve to a class identifier. |
LHS |
toLHS(CallStack callstack,
Interpreter interpreter)
|
private BshMethod |
toLocalMethod(java.lang.Object[] args)
|
java.lang.Object |
toObject(CallStack callstack,
Interpreter interpreter)
Resolve possibly complex name to an object value. |
java.lang.Object |
toObject(CallStack callstack,
Interpreter interpreter,
boolean forceClass)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public NameSpace namespace
java.lang.String value
private java.lang.String evalName
private java.lang.Object evalBaseObject
private int callstackDepth
private boolean literalThisReference
private boolean literalCallerReference
Constructor Detail |
public Name(NameSpace namespace, java.lang.String s)
getNameResolver().
Method Detail |
private void reset()
public java.lang.Object toObject(CallStack callstack, Interpreter interpreter) throws EvalError
EvalError
public java.lang.Object toObject(CallStack callstack, Interpreter interpreter, boolean forceClass) throws EvalError
forceClass
- if true then resolution will only produce a class.
This is necessary to disambiguate in cases where the grammar knows
that we want a class; where in general the var path may be taken.
EvalError
toObject()
private java.lang.Object consumeNextObjectField(CallStack callstack, Interpreter interpreter, boolean forceClass) throws EvalError
EvalError
java.lang.Object resolveThisFieldReference(CallStack callstack, NameSpace thisNamespace, Interpreter interpreter, java.lang.String varName, boolean specialFieldsVisible) throws EvalError
callstack
- may be null, but this is only legitimate in special
cases where we are sure resolution will not involve this.caller.
EvalError
public java.lang.Class toClass() throws EvalError
EvalError
public LHS toLHS(CallStack callstack, Interpreter interpreter) throws EvalError
EvalError
private BshMethod toLocalMethod(java.lang.Object[] args)
public java.lang.Object invokeMethod(Interpreter interpreter, java.lang.Object[] args, CallStack callstack, SimpleNode callerInfo) throws EvalError, ReflectError, java.lang.reflect.InvocationTargetException
EvalError
ReflectError
java.lang.reflect.InvocationTargetException
public java.lang.Object invokeLocalMethod(Interpreter interpreter, java.lang.Object[] args, CallStack callstack, SimpleNode callerInfo) throws EvalError, ReflectError, java.lang.reflect.InvocationTargetException
EvalError
ReflectError
java.lang.reflect.InvocationTargetException
static boolean isCompound(java.lang.String value)
static int countParts(java.lang.String value)
static java.lang.String prefix(java.lang.String value)
static java.lang.String prefix(java.lang.String value, int parts)
static java.lang.String suffix(java.lang.String name)
public static java.lang.String suffix(java.lang.String value, int parts)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |