Package scriptella.text
Class PropertyFormatInfo
java.lang.Object
scriptella.text.PropertyFormatInfo
Holds metadata about properties format.
Used for storing formatting/parsing rules of CSV and other text files.
- Version:
- 1.1
- Author:
- Fyodor Kupolov
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPropertyFormatInfo(Map<String, PropertyFormat> formatMap) PropertyFormatInfo(Map<String, PropertyFormat> formatMap, PropertyFormat defaultFormat) Create an instance using a map of columns formats and a default format to use for undeclared columns. -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertyFormatInfoCreates an empty format without columns.getPropertyFormat(String propertyName) Returns format for a specified property.booleanisEmpty()static PropertyFormatInfoparse(ConnectionParameters params, String prefix) static PropertyFormatInfoparse(TypedPropertiesSource properties, String prefix) Creates aPropertyFormatInfofrom specified properties.protected static voidsetProperty(PropertyFormat f, String columnPropName, String key, TypedPropertiesSource ps) toString()
-
Field Details
-
NULL_STRING
- See Also:
-
TRIM
- See Also:
-
CLASS_NAME
- See Also:
-
PATTERN
- See Also:
-
LOCALE
- See Also:
-
TYPE
- See Also:
-
PAD_LEFT
- See Also:
-
PAD_RIGHT
- See Also:
-
PAD_CHAR
- See Also:
-
-
Constructor Details
-
PropertyFormatInfo
-
PropertyFormatInfo
Create an instance using a map of columns formats and a default format to use for undeclared columns.- Parameters:
formatMap-defaultFormat- default format for undeclared columns. It does not have impact on formatting rules defined in formatMap.
-
-
Method Details
-
getPropertyFormat
Returns format for a specified property.- Parameters:
propertyName- property name.- Returns:
- format for a specified property.
-
isEmpty
public boolean isEmpty() -
getDefaultFormat
-
parse
-
parse
Creates aPropertyFormatInfofrom specified properties. The properties file has the following structure:[prefix]propertyName.key=value- Parameters:
properties- properties defining formatting.prefix- prefix for recognizing formatting properties. Nulls not allowed- Returns:
PropertyFormatInfowith a specified column formatting.
-
setProperty
protected static void setProperty(PropertyFormat f, String columnPropName, String key, TypedPropertiesSource ps) -
createEmpty
Creates an empty format without columns.- Returns:
- an empty format without columns.
-
toString
-