/gist:6f502d28811baaf620fa Secret
Created
June 19, 2013 18:44
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/ | |
public class PackageBuildContext { | |
// current package | |
private Package pkg; | |
private PackageBuilder pkgBuilder; | |
// the contianer descr | |
private BaseDescr parentDescr; | |
// errors found when building the current context | |
private List<DroolsError> errors; | |
// list of generated methods | |
private List<String> methods; | |
// map<String invokerClassName, String invokerCode> of generated invokers | |
private Map<String, String> invokers; | |
// map<String invokerClassName, ConditionalElement ce> of generated invoker lookups | |
private Map invokerLookups; | |
// map<String invokerClassName, BaseDescr descr> of descriptor lookups | |
private Map descrLookups; | |
// a simple counter for generated names | |
private int counter; | |
private DialectCompiletimeRegistry dialectRegistry; | |
private Dialect dialect; | |
private boolean typesafe; | |
public PackageBuildContext() { | |
} | |
/** | |
* Default constructor | |
*/ | |
public void init(final PackageBuilder pkgBuilder, | |
final Package pkg, | |
final BaseDescr parentDescr, | |
final DialectCompiletimeRegistry dialectRegistry, | |
final Dialect defaultDialect, | |
final Dialectable component) { | |
this.pkgBuilder = pkgBuilder; | |
this.pkg = pkg; | |
this.parentDescr = parentDescr; | |
this.methods = new ArrayList(); | |
this.invokers = new HashMap<String, String>(); | |
this.invokerLookups = new HashMap(); | |
this.descrLookups = new HashMap(); | |
this.errors = new ArrayList<DroolsError>(); | |
this.dialectRegistry = dialectRegistry; | |
this.dialect = (component != null && component.getDialect() != null) ? this.dialectRegistry.getDialect( component.getDialect() ) : defaultDialect; | |
this.typesafe = ((MVELDialect) dialectRegistry.getDialect( "mvel" )).isStrictMode(); | |
if ( dialect == null && (component != null && component.getDialect() != null) ) { | |
this.errors.add( new DescrBuildError( null, | |
parentDescr, | |
component, | |
"Unable to load Dialect '" + component.getDialect() + "'" ) ); | |
// dialect is null, but fall back to default dialect so we can attempt to compile rest of rule. | |
this.dialect = defaultDialect; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment