|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaxx.compiler.binding.DataSource
public class DataSource
Represents a Java expression which fires a PropertyChangeEvent when it can be
determined that its value may have changed. Events are fired on a "best effort" basis, and events
may either be fired too often (the value has not actually changed) or not often enough (the value
changed but no event was fired).
| Field Summary | |
|---|---|
protected String |
constantId
Constant id |
protected static org.apache.commons.logging.Log |
log
Logger |
protected List<JavaMethod> |
methods
|
| Constructor Summary | |
|---|---|
DataSource(String id,
String constantId,
String source,
JAXXCompiler compiler,
List<JavaMethod> methods)
Creates a new data source. |
|
| Method Summary | |
|---|---|
protected boolean |
compile()
Compiles the data source expression and listener. |
String |
getAddMemberListenerCode(DefaultObjectHandler handler,
String objectCode,
String memberName,
String propertyChangeListenerCode,
JAXXCompiler compiler)
Returns a snippet of Java code which will cause a PropertyChangeListener to be notified
when the member's value changes. |
String |
getObjectCode()
|
String |
getRemoveMemberListenerCode(DefaultObjectHandler handler,
String objectCode,
String memberName,
String propertyChangeListenerCode,
JAXXCompiler compiler)
|
DataListener[] |
getTrackers()
|
boolean |
hasMethod(String methodName)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected final String constantId
protected final List<JavaMethod> methods
| Constructor Detail |
|---|
public DataSource(String id,
String constantId,
String source,
JAXXCompiler compiler,
List<JavaMethod> methods)
DataSource, use compile()
to cause it to function at runtime.
id - the DataSource's idconstantId - the DataSource constant idsource - the Java source code for the data source expressioncompiler - the current JAXXCompilermethods - where to store extra method to add to binding| Method Detail |
|---|
public String getObjectCode()
public DataListener[] getTrackers()
public String toString()
toString in class Object
protected boolean compile()
throws CompilerException,
IllegalStateException
JAXXCompiler
to add the Java code that performs the data source setup. Adding listeners to DataSource is
slightly more complicated than with ordinary classes, because DataSource only exists at compile
time. You must pass in a Java expression which evaluates to a PropertyChangeListener; this
expression will be compiled and evaluated at runtime to yield the DataSource's listener.
true if the expression has dependencies, false otherwise
CompilerException - if a compilation error occurs
IllegalStateException - if data source was already compiledpublic boolean hasMethod(String methodName)
public String getAddMemberListenerCode(DefaultObjectHandler handler,
String objectCode,
String memberName,
String propertyChangeListenerCode,
JAXXCompiler compiler)
PropertyChangeListener to be notified
when the member's value changes. The PropertyChangeListener is provided in the form
of a Java code snippet that evaluates to a listener object.
For ordinary bound JavaBeans properties, the Java code returned is a simple call to
addPropertyChangeListener. Fields and methods which do not actually fire
PropertyChangeEvents when they change necessitate more complex code.
handler - Object handler (containts known eventsobjectCode - Java code which evaluates to the object to which to add the listener
*@param dataBinding the name of the data binding this listener is a part ofmemberName - the name of the field or method to listen topropertyChangeListenerCode - Java code which evaluates to a PropertyChangeListenercompiler - the current JAXXCompiler
public String getRemoveMemberListenerCode(DefaultObjectHandler handler,
String objectCode,
String memberName,
String propertyChangeListenerCode,
JAXXCompiler compiler)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||