com.sas.util.transforms
Class StringToStringListInterfaceTransform

com.sas.util.transforms.StringToStringListInterfaceTransform
All Implemented Interfaces:
com.sas.util.transforms.TransformInputOutputInterface, com.sas.util.transforms.TransformInterface, java.io.Serializable

public class StringToStringListInterfaceTransform
implements com.sas.util.transforms.TransformInputOutputInterface

A transform for converting a String to a String ListInterface

See Also:
StringListInterfaceToStringTransform, Serialized Form

Field Summary
static StringToStringListInterfaceTransform defaultInstance
          A default instance which can perform the transformation.
 java.lang.Class stringCollectionClass
          Class to instantiate when making a StringCollection Defaults to com.sas.collection.StringCollection, but subclasses may prefer another class that implements StringListInterface.
 
Constructor Summary
StringToStringListInterfaceTransform()
          Default constructor which uses a ',' delimiter.
StringToStringListInterfaceTransform(char delimiter)
          Construct a transform which uses a specific delimiter.
 
Method Summary
protected static char defaultDelimiterChar()
           
 java.lang.Class getInputClass()
           
 java.lang.Class getOutputClass()
           
protected  com.sas.collection.StringListInterface newStringList()
          Factory method to create a StringListInterface instance when transforming an object.
 java.lang.Object transform(java.lang.Object object)
          Transform a String to a StringListInterface
static com.sas.collection.StringListInterface transform(com.sas.collection.StringListInterface stringList, java.lang.String text, char delimiter)
          Transform a text string into a string list.
 

Field Detail

defaultInstance

public static final StringToStringListInterfaceTransform defaultInstance
A default instance which can perform the transformation.


stringCollectionClass

public java.lang.Class stringCollectionClass
Class to instantiate when making a StringCollection Defaults to com.sas.collection.StringCollection, but subclasses may prefer another class that implements StringListInterface. The class must have a public no-arg constructor.

Constructor Detail

StringToStringListInterfaceTransform

public StringToStringListInterfaceTransform()
Default constructor which uses a ',' delimiter.


StringToStringListInterfaceTransform

public StringToStringListInterfaceTransform(char delimiter)
Construct a transform which uses a specific delimiter.

Parameters:
delimiter - the item delimiter.
Method Detail

defaultDelimiterChar

protected static char defaultDelimiterChar()

transform

public java.lang.Object transform(java.lang.Object object)
                           throws com.sas.util.transforms.TransformException
Transform a String to a StringListInterface

Specified by:
transform in interface com.sas.util.transforms.TransformInterface
Parameters:
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.
Throws:
com.sas.util.transforms.TransformException - if the transform(dictionary, Object) method throws an exception
java.lang.ClassCastException - if object is not a String

newStringList

protected com.sas.collection.StringListInterface newStringList()
Factory method to create a StringListInterface instance when transforming an object. Creates an instance of the class referenced by stringCollectionClass, or StringCollection if stringCollectionClass is null.

Returns:
a new instance implementing StringListInterface

transform

public static com.sas.collection.StringListInterface transform(com.sas.collection.StringListInterface stringList,
                                                               java.lang.String text,
                                                               char delimiter)
                                                        throws com.sas.util.transforms.TransformException
Transform a text string into a string list.

Parameters:
stringList - items parsed from the text are appended to this string list
text - a comma separated list of items.
delimiter - the delimiter which separates the items.
Throws:
com.sas.util.transforms.TransformException - if the transform(StringListInterface, Object) method throws an exception

getInputClass

public java.lang.Class getInputClass()
Specified by:
getInputClass in interface com.sas.util.transforms.TransformInputOutputInterface

getOutputClass

public java.lang.Class getOutputClass()
Specified by:
getOutputClass in interface com.sas.util.transforms.TransformInputOutputInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.