org.apache.fop.util.text

## Class IfFieldPart

- java.lang.Object
- - org.apache.fop.util.text.IfFieldPart

- Direct Known Subclasses:
    EqualsFieldPart

      public class IfFieldPart
      extends java.lang.Object

  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
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IfFieldPart.Factory` Part factory for "if".

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `elseValue` the value being returned if the field is false
    `protected java.lang.String` | `fieldName` the field name for the part
    `protected java.lang.String` | `ifValue` the value being returned if the field is true

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IfFieldPart(java.lang.String fieldName, java.lang.String values)` Creates a new "if" field part.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isGenerated(java.util.Map params)`
    `protected boolean` | `isTrue(java.util.Map params)` Indicates whether the field's value is true.
    `protected void` | `parseValues(java.lang.String values)` Parses the parameter values
    `java.lang.String` | `toString()`
    `void` | `write(java.lang.StringBuffer sb, java.util.Map params)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### fieldName

          protected java.lang.String fieldName

      the field name for the part

    - #### ifValue

          protected java.lang.String ifValue

      the value being returned if the field is true

    - #### elseValue

          protected java.lang.String elseValue

      the value being returned if the field is false

  - ### Constructor Detail

    - #### IfFieldPart

          public IfFieldPart(java.lang.String fieldName,
                     java.lang.String values)

      Creates a new "if" field part.
      Parameters:
        `fieldName` - the field name
        `values` - the unparsed parameter values

  - ### Method Detail

    - #### parseValues

          protected void parseValues(java.lang.String values)

      Parses the parameter values
      Parameters:
        `values` - the unparsed parameter values

    - #### write

          public void write(java.lang.StringBuffer sb,
                   java.util.Map params)

    - #### isTrue

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

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright 1999-2019 The Apache Software Foundation. All Rights Reserved.