org.intermine.api.util
Class PathUtil

java.lang.Object
  extended by org.intermine.api.util.PathUtil

public final class PathUtil
extends java.lang.Object

Utility methods for Paths


Method Summary
static boolean canAssignObjectToType(java.lang.Class<?> cls, InterMineObject obj)
          Return true if given type (of a constraint) can be assigned to the InterMineObject - i.e.
static java.lang.Object resolvePath(Path path, java.lang.Object o)
          Return the object at the end of a given path, starting from the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resolvePath

public static java.lang.Object resolvePath(Path path,
                                           java.lang.Object o)
                                    throws PathException
Return the object at the end of a given path, starting from the given object.

Parameters:
path - the path to resolve
o - the start object
Returns:
the attribute, object or collection at the end of the path
Throws:
PathException - if the path does not match the object type

canAssignObjectToType

public static boolean canAssignObjectToType(java.lang.Class<?> cls,
                                            InterMineObject obj)
Return true if given type (of a constraint) can be assigned to the InterMineObject - i.e. if the class or any superclass of the InterMineObject are the type. Type can be a qualified or unqualified class name.

Parameters:
cls - the class in the model that will be assigned to
obj - the InterMineObject to check
Returns:
a boolean