jaxx.compiler.binding
Class DataSource

java.lang.Object
  extended by jaxx.compiler.binding.DataSource

public class DataSource
extends java.lang.Object

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 static org.apache.commons.logging.Log log
          Logger
 
Constructor Summary
DataSource(java.lang.String id, java.lang.String source, JAXXCompiler compiler)
          Creates a new data source.
 
Method Summary
 boolean compile(java.lang.String propertyChangeListenerCode)
          Compiles the data source expression and listener.
 java.lang.String getId()
           
 java.lang.String getListenerId()
           
 java.lang.String getObjectCode()
           
 java.lang.String getSource()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

Constructor Detail

DataSource

public DataSource(java.lang.String id,
                  java.lang.String source,
                  JAXXCompiler compiler)
Creates a new data source. After creating a DataSource, use compile(java.lang.String) to cause it to function at runtime.

Parameters:
id - the DataSource's id
source - the Java source code for the data source expression
compiler - the current JAXXCompiler
Method Detail

getId

public java.lang.String getId()

getSource

public java.lang.String getSource()

getObjectCode

public java.lang.String getObjectCode()

getListenerId

public java.lang.String getListenerId()

compile

public boolean compile(java.lang.String propertyChangeListenerCode)
                throws CompilerException,
                       java.lang.IllegalStateException
Compiles the data source expression and listener. This method calls methods in 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.

Parameters:
propertyChangeListenerCode - Java code snippet which evaluates to a PropertyChangeListener
Returns:
true if the expression has dependencies, false otherwise
Throws:
CompilerException - if a compilation error occurs
java.lang.IllegalStateException - if data source was already compiled


Copyright © 2008-2009 CodeLutin. All Rights Reserved.