Package net.sf.basedb.util.formatter
Class PropertyFilterFormatter
- java.lang.Object
-
- net.sf.basedb.util.formatter.PropertyFilterFormatter
-
- All Implemented Interfaces:
Formatter<PropertyFilter>
public class PropertyFilterFormatter extends Object implements Formatter<PropertyFilter>
Formatter for PropertyFilter items. This will create a more readable representation of the property filter than thePropertyFilter.toString()
method. It knows about some special properties and load the names of annotation types, item subtypes, etc instead of just displaying their ID values.- Since:
- 3.5
- Author:
- Nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private Formatter<Date>
dateFormatter
private DbControl
dc
private boolean
tagElements
-
Constructor Summary
Constructors Constructor Description PropertyFilterFormatter(DbControl dc, Formatter<Date> dateFormatter)
Create a new formatter.PropertyFilterFormatter(DbControl dc, Formatter<Date> dateFormatter, boolean tagElements)
Create a new formatter with option to create HTML-like tags around elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
appendListOfValues(StringBuilder sb, String value, String quote)
String
format(PropertyFilter filter)
Format a value by converting it to a string.private String
function(String function)
private String
name(String name)
private String
nameOfItem(DbControl dc, Item itemType, int id, boolean quote)
private String
operator(String op)
PropertyFilter
parseString(String value)
Parse a string and return a value of the correct type.private String
value(String value)
-
-
-
Method Detail
-
format
public String format(PropertyFilter filter)
Description copied from interface:Formatter
Format a value by converting it to a string.- Specified by:
format
in interfaceFormatter<PropertyFilter>
- Parameters:
filter
- The value to format- Returns:
- A formatted string
-
parseString
public PropertyFilter parseString(String value)
Description copied from interface:Formatter
Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.- Specified by:
parseString
in interfaceFormatter<PropertyFilter>
- Parameters:
value
- The string to parse- Returns:
- An object
- Throws:
UnsupportedOperationException
- Always
-
appendListOfValues
private void appendListOfValues(StringBuilder sb, String value, String quote)
-
-