thinkmap.datasource.database
Class SQLBinding

java.lang.Object
  extended by thinkmap.datasource.relational.Binding
      extended by thinkmap.datasource.database.SQLBinding
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LOBBinding

public class SQLBinding
extends Binding

A binding of output to a column in a sql query.

If neither columnIndex nor columnName is specified, this uses the property name.

See Also:
Serialized Form

Constructor Summary
SQLBinding()
           
SQLBinding(int index)
           
 
Method Summary
 Object bind(Message message, SourceEntity entity, EntityId id, Object results)
           
 Object bindArgument(Message message, SourceEntity entity, EntityId id)
           
protected  Object convertType(Object obj)
           
 int getColumnIndex()
          Get the column index to bind to.
 String getColumnName()
          Get the column name to bind to.
 String getProperty(Message message, SourceEntity entity, EntityId id, Object results)
          Get the name of the property for this binding.
 void setColumnIndex(int i)
          Set the column index to bind to.
 void setColumnName(String name)
          Set the column name to bind to.
 
Methods inherited from class thinkmap.datasource.relational.Binding
getOutputType, getProperty, setOutputType, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLBinding

public SQLBinding()

SQLBinding

public SQLBinding(int index)
Method Detail

bindArgument

public Object bindArgument(Message message,
                           SourceEntity entity,
                           EntityId id)
                    throws BindingException
Throws:
BindingException

bind

public Object bind(Message message,
                   SourceEntity entity,
                   EntityId id,
                   Object results)
            throws BindingException
Specified by:
bind in class Binding
Parameters:
message - incoming message
entity - the entity being bound (may be null)
id - the id of the entity being bound
results - context object; datasource-specific
Returns:
value
Throws:
BindingException

getProperty

public String getProperty(Message message,
                          SourceEntity entity,
                          EntityId id,
                          Object results)
                   throws BindingException
Description copied from class: Binding
Get the name of the property for this binding. By default, simply returns getProperty. Override this to change the property name based on the results object.

Overrides:
getProperty in class Binding
Parameters:
message - incoming message
entity - the entity being bound (may be null)
id - the id of the entity being bound
results - context object; datasource-specific
Returns:
property name
Throws:
BindingException

setColumnName

public void setColumnName(String name)
Set the column name to bind to.

Parameters:
name - column name

setColumnIndex

public void setColumnIndex(int i)
Set the column index to bind to.

Parameters:
i - column index

getColumnName

public String getColumnName()
Get the column name to bind to.

Parameters:
name - column name

getColumnIndex

public int getColumnIndex()
Get the column index to bind to.

Parameters:
i - column index

convertType

protected Object convertType(Object obj)
                      throws BindingException
Overrides:
convertType in class Binding
Throws:
BindingException


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.