Class JaloTools

java.lang.Object
de.hybris.platform.util.JaloTools

public abstract class JaloTools extends Object
tool package for useful jalo methods
  • Constructor Details

    • JaloTools

      public JaloTools()
  • Method Details

    • getTypedPrimitiveDouble

      public static double getTypedPrimitiveDouble(Object value, double defValue) throws JaloInvalidParameterException
      Returns primitive double value from Dobule value object
      Parameters:
      value - - Double object
      defValue - - if value is null then it returns this defValue
      Returns:
      double value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Double
    • getTypedPrimitiveBoolean

      public static boolean getTypedPrimitiveBoolean(Object value, boolean defValue) throws JaloInvalidParameterException
      Returns primitive boolean value from Boolean value object
      Parameters:
      value - - Boolean object
      defValue - - if value is null then it returns this defValue
      Returns:
      boolean value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Boolean
    • getTypedPrimitiveLong

      public static long getTypedPrimitiveLong(Object value, long defValue) throws JaloInvalidParameterException
      Returns primitive long value from Long value object
      Parameters:
      value - - Long object
      defValue - - if value is null then it returns this defValue
      Returns:
      long value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Long
    • getTypedPrimitiveInteger

      public static int getTypedPrimitiveInteger(Object value, int defValue) throws JaloInvalidParameterException
      Returns primitive int value from Integer value object
      Parameters:
      value - - Integer object
      defValue - - if value is null then it returns this defValue
      Returns:
      int value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Integer
    • getTypedPrimitiveByte

      public static byte getTypedPrimitiveByte(Object value, byte defValue) throws JaloInvalidParameterException
      Returns primitive byte value from Byte value object
      Parameters:
      value - - Byte object
      defValue - - if value is null then it returns this defValue
      Returns:
      byte value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Byte
    • getTypedPrimitiveChar

      public static char getTypedPrimitiveChar(Object value, char defValue) throws JaloInvalidParameterException
      Returns primitive char value from Character value object
      Parameters:
      value - - Character object
      defValue - - if value is null then it returns this defValue
      Returns:
      char value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Character
    • getTypedPrimitiveFloat

      public static float getTypedPrimitiveFloat(Object value, float defValue) throws JaloInvalidParameterException
      Returns primitive float value from Float value object
      Parameters:
      value - - Float object
      defValue - - if value is null then it returns this defValue
      Returns:
      float value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Float
    • getTypedPrimitiveShort

      public static short getTypedPrimitiveShort(Object value, short defValue) throws JaloInvalidParameterException
      Returns primitive short value from Short value object
      Parameters:
      value - - Short object
      defValue - - if value is null then it returns this defValue
      Returns:
      short value
      Throws:
      JaloInvalidParameterException - if value object isnt't instance of Short
    • convertPriceIfNecessary

      public static PriceValue convertPriceIfNecessary(PriceValue pv, boolean toNet, Currency toCurrency, Collection taxValues)
      converts a PriceValue object into a double matching the target currency and net/gross - state if necessary. this is the case when the given price value has a different net/gross flag or different currency.
      Parameters:
      pv - the base price to convert
      toNet - the target net/gross state
      toCurrency - the target currency
      taxValues - the collection of tax values which apply to this price
      Returns:
      a new PriceValue containing the converted price or pv in case no conversion was necessary
    • exportSystem

      public static void exportSystem(JaloSession session, org.znerd.xmlenc.XMLOutputter xmlDef, String extensionName)
    • exportTypeLocalizations

      public static void exportTypeLocalizations(JaloSession jaloSession, Writer wr, String extensionName)
      exports all type localisations (AtomicType, CollectionType, EnumerationType, MapType, RelationType, ItemTypesOrdered) for a given extension
      Parameters:
      jaloSession - the (current) jaloSession
      wr - the output writer
      extensionName - the name of the extension which should be exported, for core the String is null
    • exportTypeLocalization

      public static void exportTypeLocalization(Collection types, Writer wr, String extensionName, boolean ignoreExtensionName)
      export all localisations for the given extension and type
      Parameters:
      types - the type
      wr - the output writer
      extensionName - the name of the extension which should be exported, for core the String is null
      ignoreExtensionName -
    • encodeJAVA

      public static final String encodeJAVA(String input)
      Encodes JAVA entities ('\"`, '\'', '\n'). This prevents from java script errors.