Class Units

java.lang.Object
org.bgerp.plugin.inventoru.model.Units

public final class Units extends Object
Units of measure of positions, as 1C and files write them. A position keeps the unit 1C stores it in (one per nomenclature in 1C: its balances are only ever in that unit). The same unit arrives written in many ways — «шт», «шт.», «штука», «pcs» — so it is compared in a normalized form; an unknown spelling is compared as written, lower-cased.
  • Method Details

    • normalize

      public static String normalize(String unit)
      Returns:
      the unit in its normalized form, empty for none
    • same

      public static boolean same(String a, String b)
      Whether two spellings name the same unit; an empty one says nothing and matches any.
    • isPiece

      public static boolean isPiece(String unit)
      Whether the unit counts whole things.
    • isFractional

      public static boolean isFractional(BigDecimal quantity)
      Whether the quantity has a fractional part.