Package org.smooks.io.sink
Class JavaSink
- java.lang.Object
-
- org.smooks.io.sink.JavaSink
-
- All Implemented Interfaces:
org.smooks.api.io.Sink,SinkExtractor<JavaSink>
public class JavaSink extends Object implements org.smooks.api.io.Sink, SinkExtractor<JavaSink>
Java filtration/transformation result. Used to extract a Java "sink" Map from the transformation. Simply set an instance of this class as theSinkarg in the call toSmooks.filterSource(ExecutionContext, org.smooks.api.io.Source, org.smooks.api.io.Sink...).- Author:
- tom.fennelly@gmail.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJavaSink.ResultMap<K,V>
-
Field Summary
Fields Modifier and Type Field Description protected static StringLINE_SEPARATOR
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectextractFromSink(JavaSink sink, Export export)<T> TgetBean(Class<T> beanType)Get the first instance of the specified bean type from this JavaSink instance.ObjectgetBean(String name)Get the named bean from the Java Result Map.Map<String,Object>getResultMap()Get the Java result map.voidsetResultMap(Map<String,Object> resultMap)Set the Java result map.StringtoString()XML Serialized form of the bean Map associate with the result instance.
-
-
-
Field Detail
-
LINE_SEPARATOR
protected static final String LINE_SEPARATOR
-
-
Constructor Detail
-
JavaSink
public JavaSink()
Public default constructor.
-
JavaSink
public JavaSink(boolean preserveOrder)
Public default constructor.
-
JavaSink
public JavaSink(Map<String,Object> resultMap)
Public constructor. SeesetResultMap(java.util.Map).- Parameters:
resultMap- Result Map. This is the map onto which Java "result" objects will be set.
-
-
Method Detail
-
getBean
public Object getBean(String name)
Get the named bean from the Java Result Map.- Parameters:
name- the name of the bean.- Returns:
- The bean Object, or null if the bean is not in the bean Result Map.
- See Also:
getResultMap()
-
getBean
public <T> T getBean(Class<T> beanType)
Get the first instance of the specified bean type from this JavaSink instance.- Parameters:
beanType- The bean runtime class type.- Returns:
- The bean instance, otherwise null.
-
getResultMap
public Map<String,Object> getResultMap()
Get the Java result map.- Returns:
- The Java result map.
- See Also:
getBean(String)
-
setResultMap
public void setResultMap(Map<String,Object> resultMap)
Set the Java result map.- Parameters:
resultMap- The Java result map.
-
toString
public String toString()
XML Serialized form of the bean Map associate with the result instance.
-
extractFromSink
public Object extractFromSink(JavaSink sink, Export export)
- Specified by:
extractFromSinkin interfaceSinkExtractor<JavaSink>
-
-