Package com.mackenziehigh.sexpr
Class Schema.Builder
java.lang.Object
com.mackenziehigh.sexpr.Schema.Builder
- Enclosing class:
- Schema
Use an instance of this class to create a
Schema
object.-
Method Summary
Modifier and TypeMethodDescriptionUse this method to define an action that will be executed after matches of a named rule during a specific pass.Use this method to define an action that will be executed before matches of a named rule during a specific pass.build()
Use this method to obtain the new schema object.Use this method to define a predicate that can be used within a schema.defineViaAnnotations
(Object object) Given an object containing properly annotated methods, define the conditions and actions defined therein.This method imports the schema rules defined in the given string.Use this method to declare another translation pass.
-
Method Details
-
include
-
include
This method imports the schema rules defined in the given string.- Parameters:
source
- is a human-readable string indicating where the schema is from.schema
- is the textual schema to parse.- Returns:
- this.
-
condition
Use this method to define a predicate that can be used within a schema.Inside of the schema, the predicate must be referenced via a 'require' rule.
- Parameters:
name
- is the name that will be used to identify the predicate.condition
- is the predicate itself.- Returns:
- this.
- Throws:
IllegalArgumentException
- if the name already identifies a predicate.
-
pass
Use this method to declare another translation pass.Call this method multiple times in order to declare multiple passes. The translation passes will occur in the order of those invocations.
- Parameters:
name
- is the name of the new translation pass.- Returns:
- this.
-
before
Use this method to define an action that will be executed before matches of a named rule during a specific pass.- Parameters:
pass
- is the name of the pass that this action applies to.rule
- is the name of the rule that this action applies to.action
- is the action itself.- Returns:
- this.
- Throws:
IllegalArgumentException
- if the name already identifies a action.
-
after
Use this method to define an action that will be executed after matches of a named rule during a specific pass.- Parameters:
pass
- is the name of the pass that this action applies to.rule
- is the name of the rule that this action applies to.action
- is the action itself.- Returns:
- this.
- Throws:
IllegalArgumentException
- if the name already identifies a action.
-
defineViaAnnotations
Given an object containing properly annotated methods, define the conditions and actions defined therein.- Parameters:
object
- contains condition and action definitions.- Returns:
- this.
-
build
Use this method to obtain the new schema object.- Returns:
- the new matcher.
-