com.threerings.expr.util
Class ScopeUtil

java.lang.Object
  extended by com.threerings.expr.util.ScopeUtil

public class ScopeUtil
extends Object

Some general utility methods relating to scopes.


Constructor Summary
ScopeUtil()
           
 
Method Summary
static Object call(Scope scope, String name, Object... args)
          Attempts to resolve, then call the specified function with the given arguments.
static
<T> T
get(Object object, String name, Class<T> clazz)
          Attempts to retrieve the value of the identified symbol using reflection.
static Boolean resolve(Scope scope, String name, Boolean defvalue)
          Attempts to resolve a boolean symbol.
static Color4f resolve(Scope scope, String name, Color4f defvalue)
          Attempts to resolve a color symbol.
static Function resolve(Scope scope, String name, Function defvalue)
          Attempts to resolve a function symbol.
static MutableBoolean resolve(Scope scope, String name, MutableBoolean defvalue)
          Attempts to resolve a mutable boolean symbol.
static MutableFloat resolve(Scope scope, String name, MutableFloat defvalue)
          Attempts to resolve a mutable float symbol.
static MutableInteger resolve(Scope scope, String name, MutableInteger defvalue)
          Attempts to resolve a mutable integer symbol.
static MutableLong resolve(Scope scope, String name, MutableLong defvalue)
          Attempts to resolve a mutable long symbol.
static Quaternion resolve(Scope scope, String name, Quaternion defvalue)
          Attempts to resolve a quaternion symbol.
static String resolve(Scope scope, String name, String defvalue)
          Attempts to resolve a string symbol.
static
<T> T
resolve(Scope scope, String name, T defvalue, Class<T> clazz)
          Attempts to resolve the identified symbol in the given scope.
static Transform3D resolve(Scope scope, String name, Transform3D defvalue)
          Attempts to resolve a transform symbol.
static Variable resolve(Scope scope, String name, Variable defvalue)
          Attempts to resolve a variable symbol.
static Vector3f resolve(Scope scope, String name, Vector3f defvalue)
          Attempts to resolve a vector symbol.
static void updateBound(Object object, Scope scope)
          Updates the Bound fields of the specified object using the provided scope.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScopeUtil

public ScopeUtil()
Method Detail

updateBound

public static void updateBound(Object object,
                               Scope scope)
Updates the Bound fields of the specified object using the provided scope.


call

public static Object call(Scope scope,
                          String name,
                          Object... args)
Attempts to resolve, then call the specified function with the given arguments.


resolve

public static Quaternion resolve(Scope scope,
                                 String name,
                                 Quaternion defvalue)
Attempts to resolve a quaternion symbol.


resolve

public static Transform3D resolve(Scope scope,
                                  String name,
                                  Transform3D defvalue)
Attempts to resolve a transform symbol.


resolve

public static Vector3f resolve(Scope scope,
                               String name,
                               Vector3f defvalue)
Attempts to resolve a vector symbol.


resolve

public static Color4f resolve(Scope scope,
                              String name,
                              Color4f defvalue)
Attempts to resolve a color symbol.


resolve

public static String resolve(Scope scope,
                             String name,
                             String defvalue)
Attempts to resolve a string symbol.


resolve

public static Function resolve(Scope scope,
                               String name,
                               Function defvalue)
Attempts to resolve a function symbol.


resolve

public static Variable resolve(Scope scope,
                               String name,
                               Variable defvalue)
Attempts to resolve a variable symbol.


resolve

public static MutableBoolean resolve(Scope scope,
                                     String name,
                                     MutableBoolean defvalue)
Attempts to resolve a mutable boolean symbol.


resolve

public static MutableFloat resolve(Scope scope,
                                   String name,
                                   MutableFloat defvalue)
Attempts to resolve a mutable float symbol.


resolve

public static MutableInteger resolve(Scope scope,
                                     String name,
                                     MutableInteger defvalue)
Attempts to resolve a mutable integer symbol.


resolve

public static MutableLong resolve(Scope scope,
                                  String name,
                                  MutableLong defvalue)
Attempts to resolve a mutable long symbol.


resolve

public static Boolean resolve(Scope scope,
                              String name,
                              Boolean defvalue)
Attempts to resolve a boolean symbol.


resolve

public static <T> T resolve(Scope scope,
                            String name,
                            T defvalue,
                            Class<T> clazz)
Attempts to resolve the identified symbol in the given scope. If not found there, searches the parent of that scope, and so on.

Returns:
the mapping for the symbol, or defvalue if not found anywhere in the chain.

get

public static <T> T get(Object object,
                        String name,
                        Class<T> clazz)
Attempts to retrieve the value of the identified symbol using reflection.

Parameters:
object - the object upon which to reflect.
Returns:
the symbol value, or null if not found.


Copyright © 2011. All Rights Reserved.