Package org.nuiton.jaxx.compiler.binding
Class DataBinding
- java.lang.Object
-
- org.nuiton.jaxx.compiler.binding.DataBinding
-
- Direct Known Subclasses:
PseudoClassDataBinding
public class DataBinding extends Object
Represents a data binding in a JAXX file.DataBindingusesDataSourceto track changes to a source expression and update the destination.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringconstantIdprotected DataSourcedataSourceCompiled data sourceprotected StringinitDataBindingcode to register the databinding (null if no binding)protected static org.apache.logging.log4j.LoggerlogLogger.protected List<JavaMethod>methodsExtra method to add to the bindingprotected StringprocessDataBindingcode to add to processDataBinding (null if no binding)
-
Constructor Summary
Constructors Constructor Description DataBinding(String id, String source, String assignment, boolean quickNoDependencies)Creates a new data binding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompile(JAXXCompiler compiler)Compiles the data binding expression.StringgetAssignment()protected StringgetAssignment(JAXXCompiler compiler, Set<String> overrides)StringgetConstantId()StringgetInitDataBinding()protected StringgetInitDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)List<JavaMethod>getMethods()StringgetProcessDataBinding()protected StringgetProcessDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)StringgetRealId()StringgetSource()DataListener[]getTrackers()booleanisQuickNoDependencies()protected StringreplaceOverrides(JAXXCompiler compiler, Set<String> overrides, String code)StringtoString()
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
Logger.
-
constantId
protected String constantId
-
dataSource
protected DataSource dataSource
Compiled data source
-
processDataBinding
protected String processDataBinding
code to add to processDataBinding (null if no binding)
-
initDataBinding
protected String initDataBinding
code to register the databinding (null if no binding)
-
methods
protected final List<JavaMethod> methods
Extra method to add to the binding
-
-
Constructor Detail
-
DataBinding
public DataBinding(String id, String source, String assignment, boolean quickNoDependencies)
Creates a new data binding.- Parameters:
id- the data binding destination in the formid.propertyNamesource- the Java source code for the data binding expressionassignment- Java snippet which will cause the destination property to be updated with the current value of the bindingquickNoDependencies- internal flag to not treate process databinding in not a real binding
-
-
Method Detail
-
getAssignment
public String getAssignment()
-
getSource
public String getSource()
-
isQuickNoDependencies
public boolean isQuickNoDependencies()
-
getProcessDataBinding
public String getProcessDataBinding()
-
getInitDataBinding
public String getInitDataBinding()
-
getTrackers
public DataListener[] getTrackers()
-
getRealId
public String getRealId()
-
getConstantId
public String getConstantId()
-
getMethods
public List<JavaMethod> getMethods()
-
compile
public boolean compile(JAXXCompiler compiler) throws CompilerException
Compiles the data binding expression. This method calls methods inJAXXCompilerto add the Java code that performs the data binding setup.- Parameters:
compiler- compiler which includes the data binding- Returns:
trueif the expression has dependencies,falseotherwise- Throws:
CompilerException- if a compilation error occurs
-
getInitDataBindingCode
protected String getInitDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)
-
getProcessDataBindingCode
protected String getProcessDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)
-
getAssignment
protected String getAssignment(JAXXCompiler compiler, Set<String> overrides)
-
replaceOverrides
protected String replaceOverrides(JAXXCompiler compiler, Set<String> overrides, String code)
-
-