public class DataPropertyFormatterImpl extends Object implements DataPropertyFormatter
Modifier and Type | Field and Description |
---|---|
protected String |
emptyValueString
Empty value string
|
Constructor and Description |
---|
DataPropertyFormatterImpl() |
Modifier and Type | Method and Description |
---|---|
String |
formatCollection(String propertyId,
Collection c,
String separator,
String prefix,
String postfix,
Locale l)
Convert the specified list of objects to a string format where each object
is transformed into a string and separated from the other objects by comma.
|
String |
formatName(DataProperty dp,
Locale l) |
String |
formatName(String propertyId,
Locale l) |
String |
formatValue(DataProperty property,
Object value,
Locale l) |
String |
formatValue(String propertyId,
Object value,
Locale l)
Formats a value for a given property.
|
String |
getEmptyValueString() |
Class |
getPropertyClass(DataProperty property) |
String[] |
getSupportedPropertyIds()
Get the set of property ids this formatter is addressed to.
|
Object |
parsePropertyValue(Class type,
String value)
Parses a given string and returns a instance representing the java object value.
|
Object |
parsePropertyValue(DataProperty property,
String value)
Parses a given string and returns a instance representing the java object value.
|
void |
setEmptyValueString(String emptyValueString) |
@Inject protected String emptyValueString
public String[] getSupportedPropertyIds()
getSupportedPropertyIds
in interface DataPropertyFormatter
public String getEmptyValueString()
public void setEmptyValueString(String emptyValueString)
public Class getPropertyClass(DataProperty property)
getPropertyClass
in interface DataPropertyFormatter
public String formatName(DataProperty dp, Locale l)
formatName
in interface DataPropertyFormatter
public String formatName(String propertyId, Locale l)
formatName
in interface DataPropertyFormatter
public String formatValue(DataProperty property, Object value, Locale l)
formatValue
in interface DataPropertyFormatter
public String formatValue(String propertyId, Object value, Locale l)
The default formatting technique applied is quite simple. The value instance class (Integer, Long, Boolean, Date, ...) is used to format the value as string. The following list it shows which formatting mechanism is applied for a given value class:
nullValueFormat
is returned.
DateFormatter
class is used.
toString
method is used.
formatValue
in interface DataPropertyFormatter
public String formatCollection(String propertyId, Collection c, String separator, String prefix, String postfix, Locale l)
separator
- The separator between elements in the collection.prefix
- A string to be appended to the beginning of each token.postfix
- A string to be appended to the end of each token.public Object parsePropertyValue(DataProperty property, String value) throws Exception
parsePropertyValue
in interface DataPropertyFormatter
Exception
public Object parsePropertyValue(Class type, String value) throws Exception
parsePropertyValue
in interface DataPropertyFormatter
Exception
Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.