Class NumberFormat

  • All Implemented Interfaces:
    Comparable<AbstractStyle>

    public class NumberFormat
    extends AbstractStyle
    Class representing a NumberFormat entry. The NumberFormat entry is used to define cell formats like currency or date
    Author:
    Raphael Stoeckli
    • Field Detail

      • CUSTOMFORMAT_START_NUMBER

        public static final int CUSTOMFORMAT_START_NUMBER
        Start ID for custom number formats as constant
        See Also:
        Constant Field Values
    • Constructor Detail

      • NumberFormat

        public NumberFormat()
        Default constructor
    • Method Detail

      • getNumber

        public NumberFormat.FormatNumber getNumber()
        Gets the format number. Set it to custom (164) in case of custom number formats
        Returns:
        Format number
      • setNumber

        public void setNumber​(NumberFormat.FormatNumber number)
        Sets the format number. Set it to custom (164) in case of custom number formats
        Parameters:
        number - Format number
      • getCustomFormatID

        public int getCustomFormatID()
        Gets the format number of the custom format. Must be higher or equal then predefined custom number (164)
        Returns:
        Format number of the custom format
      • setCustomFormatID

        public void setCustomFormatID​(int customFormatID)
        Sets the format number of the custom format. Must be higher or equal then predefined custom number (164)
        Parameters:
        customFormatID - Format number of the custom format
      • getCustomFormatCode

        public String getCustomFormatCode()
        Gets the custom format code in the notation of Excel
        Returns:
        Custom format code
      • setCustomFormatCode

        public void setCustomFormatCode​(String customFormatCode)
        Sets the custom format code in the notation of Excel
        Parameters:
        customFormatCode - Custom format code
      • isCustomFormat

        public boolean isCustomFormat()
        Gets whether this object is a custom format
        Returns:
        Returns true in case of a custom format (higher or equals 164)
      • toString

        public String toString()
        Override toString method
        Overrides:
        toString in class Object
        Returns:
        String of a class instance
      • copy

        public NumberFormat copy()
        Method to copy the current object to a new one
        Specified by:
        copy in class AbstractStyle
        Returns:
        Copy of the current object without the internal ID
      • hashCode

        public int hashCode()
        Override method to calculate the hash of this component
        Overrides:
        hashCode in class Object
        Returns:
        Calculated hash as string