|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.util.transforms.StringToCollectionInterfaceTransform
public class StringToCollectionInterfaceTransform
A transform for converting a String
to a CollectionInterface
.
This works by tokenizing the input. Data that looks like an int
is converted to a
; long ints are converted
to Integer
Long
objects;
floating point values are converted to
objects,
true/false are converted
to Double
,
character literals are converted to a Boolean
object,
and pretty much everything else is converted to a Character
.
String
StaticCollectionInterfaceToStringTransform
,
Serialized FormField Summary | |
---|---|
java.lang.Class |
collectionClass
Which class to use to make CollectionInterface instances. |
static StringToCollectionInterfaceTransform |
defaultInstance
A default instance which can perform the transformation. |
Constructor Summary | |
---|---|
StringToCollectionInterfaceTransform()
Default constructor which uses a ',' delimiter. |
|
StringToCollectionInterfaceTransform(char delimiter)
Construct a transform which uses a specific delimiter. |
|
StringToCollectionInterfaceTransform(char delimiter,
com.sas.collection.CollectionInterface collection)
Construct a transform which uses a specific delimiter. |
Method Summary | |
---|---|
protected static char |
defaultDelimiterChar()
|
protected com.sas.collection.CollectionInterface |
newCollection()
Factory method to create a CollectionInterface instance
when transforming an object. |
com.sas.collection.CollectionInterface |
transform(com.sas.collection.CollectionInterface collection,
java.lang.String text)
Transform a text string into an collection |
java.lang.Object |
transform(java.lang.Object object)
Transform a String to a CollectionInterface |
Field Detail |
---|
public static final StringToCollectionInterfaceTransform defaultInstance
public java.lang.Class collectionClass
CollectionInterface
instances.
Defaults to com.sas.collection.Collection
.class
, but
subclasses may prefer another class that implements
CollectionInterface
. The class must have a public
no-arg constructor.
Constructor Detail |
---|
public StringToCollectionInterfaceTransform()
','
delimiter.
public StringToCollectionInterfaceTransform(char delimiter)
delimiter
- the item delimiter.public StringToCollectionInterfaceTransform(char delimiter, com.sas.collection.CollectionInterface collection)
delimiter
- the item delimiter.collection
- an output collection to return from transform(Object)Method Detail |
---|
protected static char defaultDelimiterChar()
public java.lang.Object transform(java.lang.Object object) throws com.sas.util.transforms.TransformException
String
to a CollectionInterface
transform
in interface com.sas.util.transforms.TransformInterface
object
- null
or a String
; it contains a comma separated list of items.
Individual items need not be quoted, but quotes are required to preserve
leading and/or trailing space, or of the item contains special characters,
such as escaped characters, a comma, or a '"'
double quote.
com.sas.util.transforms.TransformException
- if
the transform(collection, Object)
method throws an exception
java.lang.ClassCastException
- if object
is not a Stringprotected com.sas.collection.CollectionInterface newCollection()
CollectionInterface
instance
when transforming an object. Creates an instance of the
class referenced in collectionClass, or Collection
if that is null
.
public com.sas.collection.CollectionInterface transform(com.sas.collection.CollectionInterface collection, java.lang.String text) throws com.sas.util.transforms.TransformException
collection
- items parsed from the text are appended to this string listtext
- a comma separated list of items.
com.sas.util.transforms.TransformException
- if
the transform(Object)
method throws an exception
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |