jaxx.compiler.binding
Class DataBinding

java.lang.Object
  extended by jaxx.compiler.binding.DataBinding
Direct Known Subclasses:
PseudoClassDataBinding

public class DataBinding
extends Object

Represents a data binding in a JAXX file. DataBinding uses DataSource to track changes to a source expression and update the destination.


Field Summary
protected  String constantId
          Constant id build from the realId and used instead of realId in generated code
protected  DataSource dataSource
          Compiled data source
protected  String initDataBinding
          code to register the databinding (null if no binding)
protected static org.apache.commons.logging.Log log
          Logger.
protected  List<JavaMethod> methods
          Extra method to add to the binding
protected  String processDataBinding
          code to add to processDataBinding (null if no binding)
 
Constructor Summary
DataBinding(String id, String source, String assignment, boolean quickNoDependencies)
          Creates a new data binding.
 
Method Summary
 boolean compile(JAXXCompiler compiler)
          Compiles the data binding expression.
 String getAssignment()
           
protected  String getAssignment(JAXXCompiler compiler, Set<String> overrides)
           
 String getConstantId()
           
 String getInitDataBinding()
           
protected  String getInitDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)
           
 List<JavaMethod> getMethods()
           
 String getProcessDataBinding()
           
protected  String getProcessDataBindingCode(JAXXCompiler compiler, DataSource dataSource, boolean isBinding)
           
 String getRealId()
           
 String getSource()
           
 DataListener[] getTrackers()
           
 boolean isQuickNoDependencies()
           
protected  String replaceOverrides(JAXXCompiler compiler, Set<String> overrides, String code)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Logger.


constantId

protected String constantId
Constant id build from the realId and used instead of realId in generated code


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 form id.propertyName
source - the Java source code for the data binding expression
assignment - Java snippet which will cause the destination property to be updated with the current value of the binding
quickNoDependencies - 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()

toString

public String toString()
Overrides:
toString in class Object

compile

public boolean compile(JAXXCompiler compiler)
                throws CompilerException
Compiles the data binding expression. This method calls methods in JAXXCompiler to add the Java code that performs the data binding setup.

Parameters:
compiler - compiler which includes the data binding
Returns:
true if the expression has dependencies, false otherwise
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)


Copyright © 2008-2011 CodeLutin. All Rights Reserved.