|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.collection.ATransducerAdapter | +--net.sourceforge.esw.collection.StringTransducerAdapter
Performs transduction to or against a String of data.
This transduction occurs both ways; put()
takes data
from the IMetaCollection
instance to which this
ITransducer
instance is attached and places it into the data
source represented by this ITransducer
instance. The
get()
method takes data from the data source represented by this
ITransducer
instance and places it into the
IMetaCollection
instance to which this ITransducer
instance is attached.
This IIOTransducer
instance provides stream-based access for
stream-based ITransducer
implementors. It abstracts out the
setting and getting of the streams, or the Reader
instance and
the Writer
instance, into this interface.
This implementation of the StringTransducerAdapter
delegates all
get
and put
method invocations to the contained
IIOTransducer
instance. Also, this
StringTransducerAdapter
instance provides convenience methods to
transduce to or against a String of data.
Example:
IMetaCollection meta = MetaFactory.createMetaCollection(); IIOTransducer transducer = createIOTransducer() // for whatever // IIOTransducer instance // you need to use. StringTransducerAdapter adapter = new StringTransducerAdapter( getStringData(), // the String data transducer ); meta.setTransducer( adapter ); // Notice it is the Adapter set on the // IMetaCollectsion instance! try { meta.put(); } catch ( TransducerException te ) { te.printStackTrace(); // in case something went wrong. }
Field Summary | |
protected java.lang.String |
myString
The String of data that is get into the contained
IIOTransducer instance. |
protected java.io.StringWriter |
sWriter
The StringWriter used to capture data from a put
method invocation. |
Fields inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
ioTransducer |
Constructor Summary | |
StringTransducerAdapter()
Creates a new StringTransducerAdapter instance. |
|
StringTransducerAdapter(IIOTransducer aIIOTransducer)
Creates a new StringTransducerAdapter instance, delegating all
get and put method invocations to the specified
IIOTransducer instance. |
|
StringTransducerAdapter(java.lang.String aString)
Creates a new StringTransducerAdapter instance using the
specified String as the data for the get method
invocation. |
|
StringTransducerAdapter(java.lang.String aString,
IIOTransducer aIIOTransducer)
Creates a new StringTransducerAdapter instance with the
specified String , delegating all get and
put method invocations to the specified
IIOTransducer instance. |
Method Summary | |
void |
get(IMetaCollection aCollection)
Gets the data source's data represented by this ITransducer
instance into the referenced IMetaCollection instance. |
java.lang.String |
getString()
Returns the String of data this
StringTransducerAdapter instance received from its
put method invocation. |
void |
put(IMetaCollection aCollection)
Puts the referenced IMetaCollection instance's data into the
data source represented by this ITransducer instance. |
void |
setString(java.lang.String aString)
Sets the String of data this
StringTransducerAdapter instance uses for its get
method invocation. |
Methods inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
getContextFactory, getIOTranducer, setContextFactory, setIOTransducer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.esw.collection.ITransducer |
getContextFactory, setContextFactory |
Field Detail |
protected java.lang.String myString
get
into the contained
IIOTransducer
instance.protected java.io.StringWriter sWriter
StringWriter
used to capture data from a put
method invocation.Constructor Detail |
public StringTransducerAdapter()
StringTransducerAdapter
instance.public StringTransducerAdapter(java.lang.String aString)
StringTransducerAdapter
instance using the
specified String
as the data for the get
method
invocation.aString
- the String
for the get
method
invocation.public StringTransducerAdapter(IIOTransducer aIIOTransducer)
StringTransducerAdapter
instance, delegating all
get
and put
method invocations to the specified
IIOTransducer
instance.aIIOTransducer
- the IIOTransducer
instance to which to
delegate.public StringTransducerAdapter(java.lang.String aString, IIOTransducer aIIOTransducer)
StringTransducerAdapter
instance with the
specified String
, delegating all get
and
put
method invocations to the specified
IIOTransducer
instance.aString
- the String
for the get
method
invocation.aIIOTransducer
- the IIOTransducer
instance to which to
delegate.Method Detail |
public void setString(java.lang.String aString)
String
of data this
StringTransducerAdapter
instance uses for its get
method invocation.aString
- the String
of data for the get
method invocation.getString()
public java.lang.String getString()
String
of data this
StringTransducerAdapter
instance received from its
put
method invocation.setString( String )
public void get(IMetaCollection aCollection) throws TransducerException
ITransducer
instance into the referenced IMetaCollection
instance.
This implementation creates a Reader
instance on the
previously specified String
and sets the Reader
instance on the previously specified IIOTransducer
instance,
then calls get
on the IIOTransducer
instance.
get
in interface ITransducer
get
in class ATransducerAdapter
aCollection
- the IMetaCollection
instance into which to
read.TransducerException
- if an error occurs during transduction.put( IMetaCollection )
public void put(IMetaCollection aCollection) throws TransducerException
IMetaCollection
instance's data into the
data source represented by this ITransducer
instance.
This implementation creates a StringWriter
instance and sets
the Writer
instance on the previously specified
IIOTransducer
instance, then calls get
on the
IIOTransducer
instance. After the put
returns,
call getString
to retrieve the String data.
put
in interface ITransducer
put
in class ATransducerAdapter
aCollection
- the IMetaCollection
instance from which to
take data.TransducerException
- if an error occurs during transduction.get( IMetaCollection )
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |