Package com.ocs.dynamo.utils
Class FormatUtils
- java.lang.Object
-
- com.ocs.dynamo.utils.FormatUtils
-
public final class FormatUtils extends Object
Utilities for formatting property values- Author:
- bas.rutten
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> StringextractAndFormat(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel am, Object obj, Locale locale, String currencySymbol)Extracts a field value from an object and formats itstatic StringformatEntity(EntityModel<?> entityModel, Object value)Formats and entitystatic StringformatEntityCollection(EntityModelFactory entityModelFactory, AttributeModel attributeModel, Object collection, String separator, Locale locale, String currencySymbol)Formats a collection of entities (turns it into a comma-separated string based on the value of the "displayProperty")static <T> StringformatPropertyValue(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel model, Object value, String separator, Locale locale)Formats a property valuestatic <T> StringformatPropertyValue(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel model, Object value, String separator, Locale locale, String currencySymbol)Formats a property value
-
-
-
Method Detail
-
extractAndFormat
public static <T> String extractAndFormat(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel am, Object obj, Locale locale, String currencySymbol)
Extracts a field value from an object and formats it- Parameters:
am- the attribute modelobj- the object from which to extract the valuelocal- the localecurrencySymbol- the currency symbol- Returns:
-
formatEntity
public static String formatEntity(EntityModel<?> entityModel, Object value)
Formats and entity- Parameters:
entityModel- the entity model for the entityvalue- the entity- Returns:
-
formatEntityCollection
public static String formatEntityCollection(EntityModelFactory entityModelFactory, AttributeModel attributeModel, Object collection, String separator, Locale locale, String currencySymbol)
Formats a collection of entities (turns it into a comma-separated string based on the value of the "displayProperty")- Parameters:
entityModelFactory- the entity model factorycollection- the collection of entities to format- Returns:
-
formatPropertyValue
public static <T> String formatPropertyValue(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel model, Object value, String separator, Locale locale)
Formats a property value- Type Parameters:
T-- Parameters:
entityModelFactory-model-value-separator-locale-- Returns:
-
formatPropertyValue
public static <T> String formatPropertyValue(EntityModelFactory entityModelFactory, MessageService messageService, AttributeModel model, Object value, String separator, Locale locale, String currencySymbol)
Formats a property value- Parameters:
entityModelFactory- the entity model factoryentityModel- the entity modelmodel- the attribute modelvalue- the property valuelocale- the locale to use- Returns:
-
-