Class IfFieldPart

java.lang.Object
org.apache.fop.util.text.IfFieldPart
All Implemented Interfaces:
AdvancedMessageFormat.Part
Direct Known Subclasses:
EqualsFieldPart

public class IfFieldPart extends Object implements AdvancedMessageFormat.Part
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}
  • Field Details

    • fieldName

      protected String fieldName
      the field name for the part
    • ifValue

      protected String ifValue
      the value being returned if the field is true
    • elseValue

      protected String elseValue
      the value being returned if the field is false
  • Constructor Details

    • IfFieldPart

      public IfFieldPart(String fieldName, String values)
      Creates a new "if" field part.
      Parameters:
      fieldName - the field name
      values - the unparsed parameter values
  • Method Details

    • parseValues

      protected void parseValues(String values)
      Parses the parameter values
      Parameters:
      values - the unparsed parameter values
    • write

      public void write(StringBuffer sb, Map params)
      Writes the formatted part to a string buffer.
      Specified by:
      write in interface AdvancedMessageFormat.Part
      Parameters:
      sb - the target string buffer
      params - the parameters to work with
    • isTrue

      protected boolean isTrue(Map params)
      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

      public boolean isGenerated(Map params)
      Indicates whether there is any content that is generated by this message part.
      Specified by:
      isGenerated in interface AdvancedMessageFormat.Part
      Parameters:
      params - the parameters to work with
      Returns:
      true if the part has content
    • toString

      public String toString()
      Overrides:
      toString in class Object