Class Unit.Builder<U extends Unit<U>>

    • Constructor Detail

      • Builder

        public Builder()
        Empty constructor. Content is generated through chaining: new Unit.Builder<TypeUnit>().setId("id").setName("name");
    • Method Detail

      • getSiPrefixes

        public SIPrefixes getSiPrefixes()
        Return whether SI prefixes, ranging from yotta (y) to yocto (Y), will be generated.
        Returns:
        siPrefixes, NONE (e.g., for inch), ALL (e.g., for meter) or KILO (e.g., for kilometer)
      • getSiPrefixPowerFactor

        public double getSiPrefixPowerFactor()
        Return the power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters.
        Returns:
        siPrefixPower double; power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters
      • setSiPrefixes

        public Unit.Builder<U> setSiPrefixes​(SIPrefixes newSiPrefixes,
                                             double power)
        Set whether SI prefixes, ranging from yotta (y) to yocto (Y), are allowed. If not set; this property defaults to false.
        Parameters:
        newSiPrefixes - SIPrefixes; SIPrefixes set siPrefixes, NONE (e.g., for inch), ALL (e.g., for meter) or KILO (e.g., for kilometer)
        power - double; power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getId

        public String getId()
        Retrieve the id of the unit that this builder builds.
        Returns:
        String; the id of the unit that this builder builds
      • setId

        public Unit.Builder<U> setId​(String newId)
        Set the id of the unit that this builder builds.
        Parameters:
        newId - String; set the id of the unit that this builder builds (must be set; the default is null which is invalid)
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getAdditionalAbbreviations

        public Set<String> getAdditionalAbbreviations()
        Retrieve the additional abbreviations.
        Returns:
        Set<String>; the additional abbreviations
      • setAdditionalAbbreviations

        public Unit.Builder<U> setAdditionalAbbreviations​(String... newAdditionalAbbreviations)
        Set the additional abbreviations.
        Parameters:
        newAdditionalAbbreviations - String...; the additional abbreviations
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getDefaultDisplayAbbreviation

        public String getDefaultDisplayAbbreviation()
        Retrieve the default display abbreviation.
        Returns:
        String; the default display abbreviation
      • setDefaultDisplayAbbreviation

        public Unit.Builder<U> setDefaultDisplayAbbreviation​(String newDefaultDisplayAbbreviation)
        Set the default display abbreviation.
        Parameters:
        newDefaultDisplayAbbreviation - String; the default display abbreviation
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getDefaultTextualAbbreviation

        public String getDefaultTextualAbbreviation()
        Retrieve the default textual abbreviation.
        Returns:
        String; the default textual abbreviation
      • setDefaultTextualAbbreviation

        public Unit.Builder<U> setDefaultTextualAbbreviation​(String newDefaultTextualAbbreviation)
        Set the default textual abbreviation.
        Parameters:
        newDefaultTextualAbbreviation - String; the default textual abbreviation
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getName

        public String getName()
        Return the name.
        Returns:
        String; the name
      • setName

        public Unit.Builder<U> setName​(String newName)
        Set the name.
        Parameters:
        newName - String; the name
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getScale

        public Scale getScale()
        Retrieve the scale.
        Returns:
        Scale; the scale
      • setScale

        public Unit.Builder<U> setScale​(Scale newScale)
        Set the scale.
        Parameters:
        newScale - Scale; set the scale
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getUnitSystem

        public UnitSystem getUnitSystem()
        Retrieve the unit system.
        Returns:
        unitSystem UnitSystem; the unit system
      • setUnitSystem

        public Unit.Builder<U> setUnitSystem​(UnitSystem newUnitSystem)
        Set the unit system.
        Parameters:
        newUnitSystem - UnitSystem; the unit system
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • isGenerated

        public boolean isGenerated()
        Retrieve the generated flag.
        Returns:
        generated Boolean; the generated flag
      • setGenerated

        public Unit.Builder<U> setGenerated​(boolean newGenerated)
        Set the generated flag. Defaults to false. Should be set for units that are automatically generated.
        Parameters:
        newGenerated - boolean; the value for the generated flag
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)
      • getQuantity

        public Quantity<U> getQuantity()
        Retrieve the unit base.
        Returns:
        baseUnit BaseUnit<U>; the unit base
      • setQuantity

        public Unit.Builder<U> setQuantity​(Quantity<U> newQuantity)
        Set the unit base. Can never be null and has to be filled.
        Parameters:
        newQuantity - Quantity<U>; the unit base
        Returns:
        Builder; this builder instance that is being constructed (for method call chaining)