Package org.apache.fop.util.text
Class IfFieldPart
java.lang.Object
org.apache.fop.util.text.IfFieldPart
- All Implemented Interfaces:
AdvancedMessageFormat.Part
- Direct Known Subclasses:
EqualsFieldPart
Defines an "if" field part that checks if field's value is true or false.
It returns either of two possible values attached as additional part parameters. Example:
{field,if,Yes,No}
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isGenerated
(Map params) Indicates whether there is any content that is generated by this message part.protected boolean
Indicates whether the field's value is true.protected void
parseValues
(String values) Parses the parameter valuestoString()
void
write
(StringBuffer sb, Map params) Writes the formatted part to a string buffer.
-
Field Details
-
fieldName
the field name for the part -
ifValue
the value being returned if the field is true -
elseValue
the value being returned if the field is false
-
-
Constructor Details
-
IfFieldPart
Creates a new "if" field part.- Parameters:
fieldName
- the field namevalues
- the unparsed parameter values
-
-
Method Details
-
parseValues
Parses the parameter values- Parameters:
values
- the unparsed parameter values
-
write
Writes the formatted part to a string buffer.- Specified by:
write
in interfaceAdvancedMessageFormat.Part
- Parameters:
sb
- the target string bufferparams
- the parameters to work with
-
isTrue
Indicates whether the field's value is true. If the field is not a boolen, it is true if the field is not null.- Parameters:
params
- the message parameters- Returns:
- true the field's value as boolean
-
isGenerated
Indicates whether there is any content that is generated by this message part.- Specified by:
isGenerated
in interfaceAdvancedMessageFormat.Part
- Parameters:
params
- the parameters to work with- Returns:
- true if the part has content
-
toString
-