Package de.hybris.platform.util
Class JaloTools
java.lang.Object
de.hybris.platform.util.JaloTools
tool package for useful jalo methods
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PriceValueconvertPriceIfNecessary(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.static final StringencodeJAVA(String input) Encodes JAVA entities ('\"`, '\'', '\n').static voidexportSystem(JaloSession session, org.znerd.xmlenc.XMLOutputter xmlDef, String extensionName) static voidexportTypeLocalization(Collection types, Writer wr, String extensionName, boolean ignoreExtensionName) export all localisations for the given extension and typestatic voidexportTypeLocalizations(JaloSession jaloSession, Writer wr, String extensionName) exports all type localisations (AtomicType, CollectionType, EnumerationType, MapType, RelationType, ItemTypesOrdered) for a given extensionstatic booleangetTypedPrimitiveBoolean(Object value, boolean defValue) Returns primitive boolean value from Boolean value objectstatic bytegetTypedPrimitiveByte(Object value, byte defValue) Returns primitive byte value from Byte value objectstatic chargetTypedPrimitiveChar(Object value, char defValue) Returns primitive char value from Character value objectstatic doublegetTypedPrimitiveDouble(Object value, double defValue) Returns primitive double value from Dobule value objectstatic floatgetTypedPrimitiveFloat(Object value, float defValue) Returns primitive float value from Float value objectstatic intgetTypedPrimitiveInteger(Object value, int defValue) Returns primitive int value from Integer value objectstatic longgetTypedPrimitiveLong(Object value, long defValue) Returns primitive long value from Long value objectstatic shortgetTypedPrimitiveShort(Object value, short defValue) Returns primitive short value from Short value object
-
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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 objectdefValue- - 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 converttoNet- the target net/gross statetoCurrency- the target currencytaxValues- 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) jaloSessionwr- the output writerextensionName- 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 typewr- the output writerextensionName- the name of the extension which should be exported, for core the String is nullignoreExtensionName-
-
encodeJAVA
Encodes JAVA entities ('\"`, '\'', '\n'). This prevents from java script errors.
-