Package de.hybris.platform.util
Class JaloTools
- java.lang.Object
-
- de.hybris.platform.util.JaloTools
-
public abstract class JaloTools extends java.lang.Objecttool package for useful jalo methods
-
-
Constructor Summary
Constructors Constructor Description JaloTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PriceValueconvertPriceIfNecessary(PriceValue pv, boolean toNet, Currency toCurrency, java.util.Collection taxValues)converts a PriceValue object into a double matching the target currency and net/gross - state if necessary.static java.lang.StringencodeJAVA(java.lang.String input)Encodes JAVA entities ('\"`, '\'', '\n').static voidexportSystem(JaloSession session, org.znerd.xmlenc.XMLOutputter xmlDef, java.lang.String extensionName)static voidexportTypeLocalization(java.util.Collection types, java.io.Writer wr, java.lang.String extensionName, boolean ignoreExtensionName)export all localisations for the given extension and typestatic voidexportTypeLocalizations(JaloSession jaloSession, java.io.Writer wr, java.lang.String extensionName)exports all type localisations (AtomicType, CollectionType, EnumerationType, MapType, RelationType, ItemTypesOrdered) for a given extensionstatic booleangetTypedPrimitiveBoolean(java.lang.Object value, boolean defValue)Returns primitive boolean value from Boolean value objectstatic bytegetTypedPrimitiveByte(java.lang.Object value, byte defValue)Returns primitive byte value from Byte value objectstatic chargetTypedPrimitiveChar(java.lang.Object value, char defValue)Returns primitive char value from Character value objectstatic doublegetTypedPrimitiveDouble(java.lang.Object value, double defValue)Returns primitive double value from Dobule value objectstatic floatgetTypedPrimitiveFloat(java.lang.Object value, float defValue)Returns primitive float value from Float value objectstatic intgetTypedPrimitiveInteger(java.lang.Object value, int defValue)Returns primitive int value from Integer value objectstatic longgetTypedPrimitiveLong(java.lang.Object value, long defValue)Returns primitive long value from Long value objectstatic shortgetTypedPrimitiveShort(java.lang.Object value, short defValue)Returns primitive short value from Short value object
-
-
-
Method Detail
-
getTypedPrimitiveDouble
public static double getTypedPrimitiveDouble(java.lang.Object value, double defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, boolean defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, long defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, int defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, byte defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, char defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, float defValue) throws JaloInvalidParameterExceptionReturns 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(java.lang.Object value, short defValue) throws JaloInvalidParameterExceptionReturns 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, java.util.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, java.lang.String extensionName)
-
exportTypeLocalizations
public static void exportTypeLocalizations(JaloSession jaloSession, java.io.Writer wr, java.lang.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(java.util.Collection types, java.io.Writer wr, java.lang.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
public static final java.lang.String encodeJAVA(java.lang.String input)
Encodes JAVA entities ('\"`, '\'', '\n'). This prevents from java script errors.
-
-