Class JavaPropsSchema
- java.lang.Object
-
- com.fasterxml.jackson.dataformat.javaprop.JavaPropsSchema
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.FormatSchema
,java.io.Serializable
public class JavaPropsSchema extends java.lang.Object implements com.fasterxml.jackson.core.FormatSchema, java.io.Serializable
SimpleFormatSchema
sub-type that defines details of things like:- How are "flat" property names mapped to hierarchic POJO types, using separator-based naming convention.
- What indentation (if any) is used before key values, and between key/value
- If and how are Array values inferred from property names
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_firstArrayOffset
Specifies index number used when writing the first array entry (which in Java has index of 0).protected java.lang.String
_header
Optional header to prepend before any other output: typically a comment section or so.protected Markers
_indexMarker
Default start marker for index access, if any; empty String may be used to indicate no marker-based index detection should be made.protected java.lang.String
_keyValueSeparator
String added between key and value; needs to include the "equals character" (either '=' or ':', both allowed by Java Properties specification), may also include white before and/or after "equals character".protected java.lang.String
_lineEnding
String added after value, including at least one linefeed.protected java.lang.String
_lineIndentation
String prepended before key value, as possible indentationprotected boolean
_parseSimpleIndexes
Whether 'simple' index-notation is supported for path segments or not: simple meaning that if a path segment is a textual representation of a non-negative integer value with length of 9 or less (that is, up to but no including one billion), it will be considered index, not property name.protected java.lang.String
_pathSeparator
Default path separator to use for hierarchic paths, if any; empty String may be used to indicate that no hierarchy should be inferred using a simple separator (although index markers may still be used, if defined).protected java.lang.String
_prefix
Optional prefix to strip and append to key names.protected JPropPathSplitter
_splitter
Since splitter instances are slightly costly to build in some cases, we will lazily instantiate and cache them.protected boolean
_writeIndexUsingMarkers
Whether array-element paths are written using start/end markers (see_indexMarker
or "simple" index number: if set totrue
AND markers are specified as non-empty Strings, will use sequence ofprotected static Markers
DEFAULT_INDEX_MARKER
protected static JavaPropsSchema
EMPTY
-
Constructor Summary
Constructors Constructor Description JavaPropsSchema()
JavaPropsSchema(JavaPropsSchema base)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JavaPropsSchema
emptySchema()
int
firstArrayOffset()
java.lang.String
getSchemaType()
java.lang.String
header()
Markers
indexMarker()
java.lang.String
keyValueSeparator()
java.lang.String
lineEnding()
java.lang.String
lineIndentation()
boolean
parseSimpleIndexes()
java.lang.String
pathSeparator()
JPropPathSplitter
pathSplitter()
Accessor for getting aJPropPathSplitter
instance that does splitting according to the settings of this instance.java.lang.String
prefix()
JavaPropsSchema
withFirstArrayOffset(int v)
JavaPropsSchema
withHeader(java.lang.String v)
Mutant factory for constructing schema instance where specified header section (piece of text written out right before actual properties entries) will be used.JavaPropsSchema
withIndexMarker(Markers v)
JavaPropsSchema
withKeyValueSeparator(java.lang.String v)
JavaPropsSchema
withLineEnding(java.lang.String v)
JavaPropsSchema
withLineIndentation(java.lang.String v)
JavaPropsSchema
withoutHeader()
Convenience method, functionally equivalent to:JavaPropsSchema
withoutIndexMarker()
JavaPropsSchema
withoutLineIndentation()
JavaPropsSchema
withoutPathSeparator()
Mutant factory method for constructing a new instance that specifies that no "path splitting" is to be done: this is similar to default behavior ofProperties
in which keys are full Strings and there is no nesting of values.JavaPropsSchema
withParseSimpleIndexes(boolean v)
JavaPropsSchema
withPathSeparator(java.lang.String v)
Mutant factory method for constructing a new instance with specified path separator; default being comma (".").JavaPropsSchema
withPrefix(java.lang.String v)
Mutant factory for constructing schema instance where specified prefix is prepended before logical path when generator writes output and removed by parser before binding back as properties.JavaPropsSchema
withWriteIndexUsingMarkers(boolean v)
boolean
writeIndexUsingMarkers()
-
-
-
Field Detail
-
DEFAULT_INDEX_MARKER
protected static final Markers DEFAULT_INDEX_MARKER
-
EMPTY
protected static final JavaPropsSchema EMPTY
-
_splitter
protected transient JPropPathSplitter _splitter
Since splitter instances are slightly costly to build in some cases, we will lazily instantiate and cache them.
-
_firstArrayOffset
protected int _firstArrayOffset
Specifies index number used when writing the first array entry (which in Java has index of 0). After this initial value, additional elements will have consecutive values, incremented by 1. Note that this setting has no effect on reading: input indexes are only used for sorting values, and their exact values have no meaning.Default value is 1.
-
_pathSeparator
protected java.lang.String _pathSeparator
Default path separator to use for hierarchic paths, if any; empty String may be used to indicate that no hierarchy should be inferred using a simple separator (although index markers may still be used, if defined).
-
_indexMarker
protected Markers _indexMarker
Default start marker for index access, if any; empty String may be used to indicate no marker-based index detection should be made.Default value of "[" is usually combined with end marker of "]" to allow C/Java-style bracket notation, like "settings.path[1]".
-
_parseSimpleIndexes
protected boolean _parseSimpleIndexes
Whether 'simple' index-notation is supported for path segments or not: simple meaning that if a path segment is a textual representation of a non-negative integer value with length of 9 or less (that is, up to but no including one billion), it will be considered index, not property name.Note that this settings does NOT control whether "start/end marker" indicated indexes are enabled or not; those depend on
_indexMarker
.Default value is
true
, "plain" index segments are supported.
-
_writeIndexUsingMarkers
protected boolean _writeIndexUsingMarkers
Whether array-element paths are written using start/end markers (see_indexMarker
or "simple" index number: if set totrue
AND markers are specified as non-empty Strings, will use sequence ofstartMarker index endMarker
to include index in path; otherwise will simply use textual representation of the index number as path segment, prefixed by path separator as necessary.
-
_lineIndentation
protected java.lang.String _lineIndentation
String prepended before key value, as possible indentation
-
_keyValueSeparator
protected java.lang.String _keyValueSeparator
String added between key and value; needs to include the "equals character" (either '=' or ':', both allowed by Java Properties specification), may also include white before and/or after "equals character". Default value is a single '=' character with no white spaces around
-
_lineEnding
protected java.lang.String _lineEnding
String added after value, including at least one linefeed. Default value is the 'Unix linefeed'.
-
_header
protected java.lang.String _header
Optional header to prepend before any other output: typically a comment section or so. Note that contents here are NOT modified in any way, meaning that any comment indicators (leading '#' or '!') and linefeeds MUST be specified by caller.
-
_prefix
protected java.lang.String _prefix
Optional prefix to strip and append to key names. Useful when subset of properties need to be processed.- Since:
- 2.10
-
-
Constructor Detail
-
JavaPropsSchema
public JavaPropsSchema()
-
JavaPropsSchema
public JavaPropsSchema(JavaPropsSchema base)
-
-
Method Detail
-
pathSplitter
public JPropPathSplitter pathSplitter()
Accessor for getting aJPropPathSplitter
instance that does splitting according to the settings of this instance.Note that instance is constructed lazily as needed, but reused afterwards for this instance (and for these specific settings).
-
withFirstArrayOffset
public JavaPropsSchema withFirstArrayOffset(int v)
-
withPathSeparator
public JavaPropsSchema withPathSeparator(java.lang.String v)
Mutant factory method for constructing a new instance with specified path separator; default being comma ("."). Note that setting separator to `null` or empty String will basically disable handling of nesting, similar to callingwithoutPathSeparator()
.
-
withoutPathSeparator
public JavaPropsSchema withoutPathSeparator()
Mutant factory method for constructing a new instance that specifies that no "path splitting" is to be done: this is similar to default behavior ofProperties
in which keys are full Strings and there is no nesting of values.
-
withIndexMarker
public JavaPropsSchema withIndexMarker(Markers v)
-
withoutIndexMarker
public JavaPropsSchema withoutIndexMarker()
-
withParseSimpleIndexes
public JavaPropsSchema withParseSimpleIndexes(boolean v)
-
withWriteIndexUsingMarkers
public JavaPropsSchema withWriteIndexUsingMarkers(boolean v)
-
withLineIndentation
public JavaPropsSchema withLineIndentation(java.lang.String v)
-
withoutLineIndentation
public JavaPropsSchema withoutLineIndentation()
- Since:
- 2.8
-
withKeyValueSeparator
public JavaPropsSchema withKeyValueSeparator(java.lang.String v)
-
withLineEnding
public JavaPropsSchema withLineEnding(java.lang.String v)
-
withPrefix
public JavaPropsSchema withPrefix(java.lang.String v)
Mutant factory for constructing schema instance where specified prefix is prepended before logical path when generator writes output and removed by parser before binding back as properties.- Since:
- 2.10
-
withHeader
public JavaPropsSchema withHeader(java.lang.String v)
Mutant factory for constructing schema instance where specified header section (piece of text written out right before actual properties entries) will be used. Note that caller must specify any and all linefeeds to use: generator will NOT modify header String contents in any way, and will not append a linefeed after contents (if any).
-
withoutHeader
public JavaPropsSchema withoutHeader()
Convenience method, functionally equivalent to:withHeader("")
used to ensure that no header is prepended before actual property values are output.- Since:
- 2.8
-
getSchemaType
public java.lang.String getSchemaType()
- Specified by:
getSchemaType
in interfacecom.fasterxml.jackson.core.FormatSchema
-
emptySchema
public static JavaPropsSchema emptySchema()
-
firstArrayOffset
public int firstArrayOffset()
-
header
public java.lang.String header()
-
indexMarker
public Markers indexMarker()
-
lineEnding
public java.lang.String lineEnding()
-
lineIndentation
public java.lang.String lineIndentation()
-
keyValueSeparator
public java.lang.String keyValueSeparator()
-
parseSimpleIndexes
public boolean parseSimpleIndexes()
-
pathSeparator
public java.lang.String pathSeparator()
-
prefix
public java.lang.String prefix()
- Since:
- 2.10
-
writeIndexUsingMarkers
public boolean writeIndexUsingMarkers()
-
-