org.apache.fop.fo.properties

## Class NumberProperty

- java.lang.Object
- - org.apache.fop.fo.properties.Property
  - - org.apache.fop.fo.properties.NumberProperty

- All Implemented Interfaces:
    Numeric

      public final class NumberProperty
      extends Property
      implements Numeric

  Class for handling numeric properties

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `NumberProperty.Maker` Inner class for making NumberProperty objects
    `static class` | `NumberProperty.PositiveIntegerMaker` A positive integer property maker.

  - ### Field Summary

    - ### Fields inherited from class org.apache.fop.fo.properties.Property

      `log`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `Color` | `getColor(FOUserAgent foUserAgent)` Convert NumberProperty to a Color.
    `int` | `getDimension()` Plain number always has a dimension of 0.
    `static NumberProperty` | `getInstance(double num)` Returns the canonical NumberProperty instance corresponding to the given double
    `static NumberProperty` | `getInstance(Double num)` Returns the canonical NumberProperty instance corresponding to the given Number
    `static NumberProperty` | `getInstance(int num)` Returns the canonical NumberProperty instance corresponding to the given int
    `static NumberProperty` | `getInstance(Integer num)` Returns the canonical NumberProperty instance corresponding to the given Integer
    `Length` | `getLength()` This method expects to be overridden by subclasses
    `Number` | `getNumber()` This method expects to be overridden by subclasses
    `Numeric` | `getNumeric()` Convert NumberProperty to Numeric object
    `double` | `getNumericValue()` Return the value of this Numeric.
    `double` | `getNumericValue(PercentBaseContext context)` Return the value of this Numeric.
    `Object` | `getObject()` This method expects to be overridden by subclasses
    `int` | `getValue()` Returns the value of this numeric as an int.
    `int` | `getValue(PercentBaseContext context)` Return the value
    `int` | `hashCode()`
    `boolean` | `isAbsolute()` Return true because all numbers are absolute.

    - ### Methods inherited from class org.apache.fop.fo.properties.Property

      `getCharacter, getCondLength, getEnum, getKeep, getLengthPair, getLengthRange, getList, getNCname, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue, toString`

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

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

    - ### Methods inherited from interface org.apache.fop.datatypes.Numeric

      `getEnum`

- - ### Method Detail

    - #### getInstance

          public static NumberProperty getInstance(Double num)

      Returns the canonical NumberProperty instance corresponding to the given Number
      Parameters:
        `num` - the base Double
      Returns:
        the canonical NumberProperty

    - #### getInstance

          public static NumberProperty getInstance(Integer num)

      Returns the canonical NumberProperty instance corresponding to the given Integer
      Parameters:
        `num` - the base Integer
      Returns:
        the canonical NumberProperty

    - #### getInstance

          public static NumberProperty getInstance(double num)

      Returns the canonical NumberProperty instance corresponding to the given double
      Parameters:
        `num` - the base double value
      Returns:
        the canonical NumberProperty

    - #### getInstance

          public static NumberProperty getInstance(int num)

      Returns the canonical NumberProperty instance corresponding to the given int
      Parameters:
        `num` - the base int value
      Returns:
        the canonical NumberProperty

    - #### getDimension

          public int getDimension()

      Plain number always has a dimension of 0.
      Specified by:
        `getDimension` in interface `Numeric`
      Returns:
        a dimension of 0.

    - #### getNumericValue

          public double getNumericValue()

      Return the value of this Numeric.
      Specified by:
        `getNumericValue` in interface `Numeric`
      Returns:
        The value as a double.

    - #### getNumericValue

          public double getNumericValue(PercentBaseContext context)

      Return the value of this Numeric.
      Specified by:
        `getNumericValue` in interface `Numeric`
      Parameters:
        `context` - Evaluation context
      Returns:
        The value as a double.

    - #### getValue

          public int getValue()

      Returns the value of this numeric as an int.
      Specified by:
        `getValue` in interface `Numeric`
      Returns:
        the value as an integer.

    - #### getValue

          public int getValue(PercentBaseContext context)

      Return the value
      Specified by:
        `getValue` in interface `Numeric`
      Parameters:
        `context` - Evaluation context
      Returns:
        The value as an int.

    - #### isAbsolute

          public boolean isAbsolute()

      Return true because all numbers are absolute.
      Specified by:
        `isAbsolute` in interface `Numeric`
      Returns:
        true.

    - #### getNumber

          public Number getNumber()

      Description copied from class: `Property`
      This method expects to be overridden by subclasses
      Overrides:
        `getNumber` in class `Property`
      Returns:
        this.number cast as a Number

    - #### getObject

          public Object getObject()

      Description copied from class: `Property`
      This method expects to be overridden by subclasses
      Overrides:
        `getObject` in class `Property`
      Returns:
        this.number cast as an Object

    - #### getNumeric

          public Numeric getNumeric()

      Convert NumberProperty to Numeric object
      Overrides:
        `getNumeric` in class `Property`
      Returns:
        Numeric object corresponding to this

    - #### getLength

          public Length getLength()

      This method expects to be overridden by subclasses
      Overrides:
        `getLength` in class `Property`
      Returns:
        Length property value

    - #### getColor

          public Color getColor(FOUserAgent foUserAgent)

      Convert NumberProperty to a Color. Not sure why this is needed.
      Overrides:
        `getColor` in class `Property`
      Parameters:
        `foUserAgent` - FOUserAgent
      Returns:
        Color that corresponds to black

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2023 Apache Software Foundation. All rights reserved.