com.whicken.werecat
Class RuleFactory

java.lang.Object
  extended by com.whicken.werecat.RuleFactory
Direct Known Subclasses:
BlindFactory

public class RuleFactory
extends java.lang.Object

Helper class for instantiating a RuleEngine. Subclass to provide appropriate hooks for expression parser.


Field Summary
protected  java.lang.Class context
           
protected  java.util.Map<java.lang.String,java.lang.Class> importedClasses
           
protected  java.util.List<java.lang.String> importedPackages
           
 
Constructor Summary
RuleFactory(java.lang.Class context)
           
 
Method Summary
 void addImport(java.lang.Class c)
          Make the given class accessible by simple name.
 void addImport(java.lang.String path)
          Make the given classes accessible by simple name.
 com.whicken.werecat.expr.Expression createCompoundExpression(com.whicken.werecat.expr.Expression lhs, java.lang.Object rhs)
           
 com.whicken.werecat.expr.Expression createField(java.lang.String key)
          Override this is you want something different than reflection.
 com.whicken.werecat.expr.Expression createMethod(java.lang.String method, java.util.List<com.whicken.werecat.expr.Expression> args)
          Override this is you want something different than reflection.
protected  java.lang.Class getClass(java.lang.String name)
           
static java.lang.reflect.Method getMethod(java.lang.Class context, java.lang.String method, java.util.List<com.whicken.werecat.expr.Expression> args)
          Requires the method to be public
protected  java.lang.reflect.Method getMethod(java.lang.String method, java.util.List<com.whicken.werecat.expr.Expression> args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected java.lang.Class context

importedClasses

protected java.util.Map<java.lang.String,java.lang.Class> importedClasses

importedPackages

protected java.util.List<java.lang.String> importedPackages
Constructor Detail

RuleFactory

public RuleFactory(java.lang.Class context)
Method Detail

addImport

public void addImport(java.lang.String path)
Make the given classes accessible by simple name. You may use wildcards or explicit paths.


addImport

public void addImport(java.lang.Class c)
Make the given class accessible by simple name.


getClass

protected java.lang.Class getClass(java.lang.String name)

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Class context,
                                                 java.lang.String method,
                                                 java.util.List<com.whicken.werecat.expr.Expression> args)
Requires the method to be public


getMethod

protected java.lang.reflect.Method getMethod(java.lang.String method,
                                             java.util.List<com.whicken.werecat.expr.Expression> args)

createField

public com.whicken.werecat.expr.Expression createField(java.lang.String key)
Override this is you want something different than reflection.


createMethod

public com.whicken.werecat.expr.Expression createMethod(java.lang.String method,
                                                        java.util.List<com.whicken.werecat.expr.Expression> args)
Override this is you want something different than reflection.


createCompoundExpression

public com.whicken.werecat.expr.Expression createCompoundExpression(com.whicken.werecat.expr.Expression lhs,
                                                                    java.lang.Object rhs)