public class DataBindingHelper extends Object
Note : The code in this class was previously directly in JAXXCompiler, now prefer have a separate
class to make JAXXCompiler more simple and clear.
Created: 27 nov. 2009
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Integer> |
autoUnsafeGenIds
Counter by unsafe type
|
protected JAXXCompiler |
compiler
Associated compiler
|
protected List<DataBinding> |
dataBindings
Registred data binding for the compiler, then after the invocation of method
finalizeBindings()
only the real data bindings, the simple bindings will be moved to simpleBindings. |
protected static Matcher |
leftBraceMatcher
left brace matcher
|
protected static Matcher |
rightBraceMatcher
right brace matcher
|
static boolean |
SHOW_LOG
To debug binding without any log interference
|
protected List<DataBinding> |
simpleBindings
Simpel bindings for the compiler
|
| Constructor and Description |
|---|
DataBindingHelper(JAXXCompiler compiler) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
finalizeBindings()
Compile all binding discovered previously.
|
DataBinding[] |
getDataBindings() |
protected static int |
getNextLeftBrace(String string,
int pos) |
protected static int |
getNextRightBrace(String string,
int pos) |
String |
getSafeId(String id)
Obtain the next safe id for the given binding id.
|
DataBinding[] |
getSimpleBindings() |
String |
processDataBindings(String stringValue)
Examine an attribute value for data binding expressions.
|
void |
registerDataBinding(DataBinding binding) |
void |
registerDataBinding(String id,
String binding,
String assignment) |
void |
revertSafeId(String id)
Revert a previous computed safe id.
|
public static boolean SHOW_LOG
protected static final Matcher leftBraceMatcher
protected static final Matcher rightBraceMatcher
protected final List<DataBinding> dataBindings
finalizeBindings()
only the real data bindings, the simple bindings will be moved to simpleBindings.protected final List<DataBinding> simpleBindings
protected final JAXXCompiler compiler
public DataBindingHelper(JAXXCompiler compiler)
public String processDataBindings(String stringValue) throws CompilerException
registerDataBinding(java.lang.String, java.lang.String, java.lang.String).
If the attribute value does not invoke data binding, this method returns nullstringValue - the string value of the property from the XMLCompilerException - ?public DataBinding[] getDataBindings()
public DataBinding[] getSimpleBindings()
public void registerDataBinding(DataBinding binding)
public void clear()
public String getSafeId(String id)
With css, we can obtain the same binding id, so we must check for unicity each time we want a new binding id.
If an id is already taken, we suffix by _XXX until
found a free id.
id - the id of the bindingpublic void revertSafeId(String id)
This is needed when a binding compiled is not an data binding, we want to free the safe id to avoid hole in numbers.
id - the original id to revert in counter.public void finalizeBindings()
If a binding is not a dataBinding, then move it from the list dataBindings to simpleBindings.
protected static int getNextLeftBrace(String string, int pos)
protected static int getNextRightBrace(String string, int pos)
Copyright © 2008–2017 Ultreia.io. All rights reserved.