-
public interface StructuredFormat
Interface providing a structured format such as JSON or XML.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
ART_BOOLEAN_VALUE
The (XML) attribute for a boolean value.static String
ART_NUMBER_VALUE
The (XML) attribute for a numeric value.static String
ART_STRING_VALUE
The (XML) attribute for a string value.static String
ID_JSON
Name
of JSON format.static String
ID_XML
Name
of XML format.static String
ID_YAML
Name
of YAML format.static String
NS_PREFIX_ARRAY
The (XML) namespace prefix for an array.static String
NS_PREFIX_OBJECT
The (XML) namespace prefix for an object.static String
NS_URI_ARRAY
The (XML) namespace URI for an array.static String
NS_URI_OBJECT
The (XML) namespace URI for an object.static String
TAG_ITEM
The (XML) tag for an array item.static String
TAG_ROOT
The (XML) root tag.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
getId()
default void
read(String data, UnmarshallableObject object)
default StructuredReader
reader(InputStream in)
StructuredReader
reader(Reader reader)
default StructuredReader
reader(Object data)
default StructuredReader
reader(String data)
default String
write(MarshallableObject object)
default StructuredWriter
writer(OutputStream out)
StructuredWriter
writer(Appendable writer)
-
-
-
Field Detail
-
ID_JSON
static final String ID_JSON
Name
of JSON format.- See Also:
- Constant Field Values
-
ID_XML
static final String ID_XML
Name
of XML format.- See Also:
- Constant Field Values
-
ID_YAML
static final String ID_YAML
Name
of YAML format.- See Also:
- Constant Field Values
-
NS_PREFIX_OBJECT
static final String NS_PREFIX_OBJECT
The (XML) namespace prefix for an object.- See Also:
- Constant Field Values
-
NS_URI_OBJECT
static final String NS_URI_OBJECT
The (XML) namespace URI for an object.- See Also:
- Constant Field Values
-
NS_PREFIX_ARRAY
static final String NS_PREFIX_ARRAY
The (XML) namespace prefix for an array.- See Also:
- Constant Field Values
-
NS_URI_ARRAY
static final String NS_URI_ARRAY
The (XML) namespace URI for an array.- See Also:
- Constant Field Values
-
TAG_ROOT
static final String TAG_ROOT
The (XML) root tag.- See Also:
- Constant Field Values
-
TAG_ITEM
static final String TAG_ITEM
The (XML) tag for an array item.- See Also:
- Constant Field Values
-
ART_STRING_VALUE
static final String ART_STRING_VALUE
The (XML) attribute for a string value.- See Also:
- Constant Field Values
-
ART_BOOLEAN_VALUE
static final String ART_BOOLEAN_VALUE
The (XML) attribute for a boolean value.- See Also:
- Constant Field Values
-
ART_NUMBER_VALUE
static final String ART_NUMBER_VALUE
The (XML) attribute for a numeric value.- See Also:
- Constant Field Values
-
-
Method Detail
-
reader
StructuredReader reader(Reader reader)
- Parameters:
reader
- theReader
pointing to the structured data to read and parse.- Returns:
- the
StructuredReader
.
-
reader
default StructuredReader reader(InputStream in)
- Parameters:
in
- theInputStream
pointing to the structured data to read (in UTF-8) and parse.- Returns:
- the
StructuredReader
.
-
reader
default StructuredReader reader(String data)
- Parameters:
data
- the structured data asString
.- Returns:
- the
StructuredReader
.
-
read
default void read(String data, UnmarshallableObject object)
- Parameters:
data
- the structured data asString
.object
- theUnmarshallableObject
to read.- See Also:
UnmarshallableObject.read(StructuredReader)
-
reader
default StructuredReader reader(Object data)
- Parameters:
data
- the data as a potentially proprietary implementation-specific type.- Returns:
- the
StringReader
.
-
writer
StructuredWriter writer(Appendable writer)
- Parameters:
writer
- theAppendable
(Writer
orStringBuilder
) where to write the structured data to.- Returns:
- the wrapped
StructuredWriter
.
-
writer
default StructuredWriter writer(OutputStream out)
- Parameters:
out
- theOutputStream
where to write the structured data to (in UTF-8).- Returns:
- the wrapped
StructuredWriter
.
-
write
default String write(MarshallableObject object)
- Parameters:
object
- theMarshallableObject
to serialize.- Returns:
- the serialized data as
String
.
-
-