Package org.smooks.io.sink
Class JavaSink
- java.lang.Object
-
- org.smooks.io.sink.FilterSink
-
- org.smooks.io.sink.JavaSink
-
- All Implemented Interfaces:
Sink
,SinkExtractor<JavaSink>
public class JavaSink extends FilterSink implements SinkExtractor<JavaSink>
Java filtration/transformation result. Used to extract a Java "sink
" Map from the transformation. Simply set an instance of this class as theSink
arg 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 class
JavaSink.ResultMap<K,V>
-
Field Summary
-
Fields inherited from class org.smooks.io.sink.FilterSink
SINKS_TYPED_KEY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
extractFromSink(JavaSink sink, Export export)
<T> T
getBean(Class<T> beanType)
Get the first instance of the specified bean type from this JavaSink instance.Object
getBean(String name)
Get the named bean from the Java Result Map.Map<String,Object>
getResultMap()
Get the Java result map.void
setResultMap(Map<String,Object> resultMap)
Set the Java result map.String
toString()
XML Serialized form of the bean Map associate with the result instance.-
Methods inherited from class org.smooks.io.sink.FilterSink
getSink, getSinks, setSinks
-
-
-
-
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:
extractFromSink
in interfaceSinkExtractor<JavaSink>
-
-