Class IfFieldPart

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

public class IfFieldPart extends Object implements org.apache.fop.util.text.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)
      Specified by:
      write in interface org.apache.fop.util.text.AdvancedMessageFormat.Part
    • 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)
      Specified by:
      isGenerated in interface org.apache.fop.util.text.AdvancedMessageFormat.Part
    • toString

      public String toString()
      Overrides:
      toString in class Object