T
- the output property typepublic class TransformerOutputProperty<T> extends Object
Transformer
in a
typed way.Constructor and Description |
---|
TransformerOutputProperty(String name,
Function<T,String> serializer,
Function<String,T> deserializer)
Creates a new
TransformerOutputProperty instance. |
Modifier and Type | Method and Description |
---|---|
static TransformerOutputProperty<Boolean> |
booleanOutputProperty(String name)
Creates a boolean
TransformerOutputProperty . |
static TransformerOutputProperty<Class<?>> |
classOutputProperty(String name)
Creates a class
TransformerOutputProperty . |
T |
get(Transformer transformer)
Get an output property that is in effect for the transformer.
|
protected Function<String,T> |
getDeserializer()
Output Property Deserializer
|
String |
getName()
Output Property Name
|
protected Function<T,String> |
getSerializer()
Output Property Serializer
|
static TransformerOutputProperty<Integer> |
integerOutputProperty(String name)
Creates an integer
TransformerOutputProperty . |
void |
set(Transformer transformer,
T value)
Set an output property that will be in effect for the transformation.
|
static TransformerOutputProperty<String> |
stringOutputProperty(String name)
Creates a string
TransformerOutputProperty . |
public TransformerOutputProperty(String name, Function<T,String> serializer, Function<String,T> deserializer)
TransformerOutputProperty
instance.name
- Output Property Nameserializer
- Output Property Serializerdeserializer
- Output Property Deserializerpublic static TransformerOutputProperty<Boolean> booleanOutputProperty(String name)
TransformerOutputProperty
.
Value yes
means true
and value no
means
false
.
name
- the output property nameTransformerOutputProperty
public static TransformerOutputProperty<Class<?>> classOutputProperty(String name)
TransformerOutputProperty
.name
- the output property nameTransformerOutputProperty
public static TransformerOutputProperty<Integer> integerOutputProperty(String name)
TransformerOutputProperty
.name
- the output property nameTransformerOutputProperty
public static TransformerOutputProperty<String> stringOutputProperty(String name)
TransformerOutputProperty
.name
- the output property nameTransformerOutputProperty
public T get(Transformer transformer)
If a property has been set using
Transformer.setOutputProperty(String, String)
, that value will be
returned. Otherwise, if a property is explicitly specified in the stylesheet,
that value will be returned. If the value of the property has been defaulted,
that is, if no value has been set explicitly either with
Transformer.setOutputProperty(String, String)
or in the stylesheet,
the result may vary depending on implementation and input stylesheet.
transformer
- the transformernull
if no
property was foundIllegalArgumentException
- if the property is not supportedTransformerOutputProperties
public void set(Transformer transformer, T value)
Pass a qualified property name as a two-part string, the namespace URI
enclosed in curly braces ({}
), followed by the local name. If the
name has a null
URL, the String only contain the local name. An
application can safely check for a non-null
URI by testing to see if
the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined
with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>
,
then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo".
Note that no prefix is used.
The Properties object that was passed to
Transformer.setOutputProperties(java.util.Properties)
won't be
effected by calling this method.
transformer
- the transformervalue
- The non-null string value of the output property.IllegalArgumentException
- if the property is not supported, and is not
qualified with a namespaceTransformerOutputProperties
public String getName()
protected Function<T,String> getSerializer()
Copyright © 2025. All rights reserved.