|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjfun.jaskell.DefaultResolver
public class DefaultResolver
This is the default implementation of Resolver interface. It returns the default value for unbound variable and undefined tuple member.
Constructor Summary | |
---|---|
protected |
DefaultResolver()
|
Method Summary | |
---|---|
static Tuple |
asTuple(java.lang.Object obj)
Convert an object to a Tuple if it is not already a Tuple. |
static Resolver |
instance()
To get an instance of this implementation. |
java.lang.Object |
resolveMember(java.lang.Object obj,
java.lang.String name,
java.lang.Object def)
This implementation converts the object to a tuple, and if the member name is contained in the tuple, resolution succeeded with the tuple member value; otherwise, default value is returned. |
java.lang.Object |
resolveSubscript(java.lang.Object obj,
java.lang.Object[] args,
java.lang.Object def)
This implementation applies subscript to array, list, java.util.Map and Tuple. |
java.lang.Object |
resolveVar(java.lang.String name,
java.lang.Object def)
Simply return the default value as an indicator of resolution failure. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected DefaultResolver()
Method Detail |
---|
public java.lang.Object resolveVar(java.lang.String name, java.lang.Object def)
resolveVar
in interface Resolver
name
- the variable name.def
- the default value.
public java.lang.Object resolveMember(java.lang.Object obj, java.lang.String name, java.lang.Object def)
resolveMember
in interface Resolver
obj
- the object.name
- the member name.def
- the default value.
public java.lang.Object resolveSubscript(java.lang.Object obj, java.lang.Object[] args, java.lang.Object def)
resolveSubscript
in interface Resolver
obj
- the object.args
- the subscripts.def
- the default value.
public static Resolver instance()
public java.lang.String toString()
toString
in class java.lang.Object
public static Tuple asTuple(java.lang.Object obj)
obj
- the object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |