public class DataSource extends Object
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).| Modifier and Type | Field and Description |
|---|---|
protected String |
constantId
Constant id
|
protected static org.apache.commons.logging.Log |
log
Logger
|
protected List<JavaMethod> |
methods |
| Constructor and Description |
|---|
DataSource(String id,
String constantId,
String source,
JAXXCompiler compiler,
List<JavaMethod> methods)
Creates a new data source.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
protected ClassDescriptor |
getMethodReturnType(ClassDescriptor contextClass,
MethodDescriptor method)
Given a method from a given context class, try to obtain his method
return type.
|
String |
getObjectCode() |
Set<String> |
getOverrideIds() |
String |
getRemoveMemberListenerCode(DefaultObjectHandler handler,
String objectCode,
String memberName,
String propertyChangeListenerCode,
JAXXCompiler compiler) |
DataListener[] |
getTrackers() |
boolean |
hasMethod(String methodName) |
boolean |
showLog() |
String |
toString() |
protected static final org.apache.commons.logging.Log log
protected final String constantId
protected final List<JavaMethod> methods
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 bindingpublic String getObjectCode()
public DataListener[] getTrackers()
public boolean showLog()
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 otherwiseCompilerException - if a compilation error occursIllegalStateException - 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 JAXXCompilerpublic String getRemoveMemberListenerCode(DefaultObjectHandler handler, String objectCode, String memberName, String propertyChangeListenerCode, JAXXCompiler compiler)
protected ClassDescriptor getMethodReturnType(ClassDescriptor contextClass, MethodDescriptor method)
contextClass - the context class of the methodmethod - the methodCopyright © 2008–2017 Ultreia.io. All rights reserved.