Class CompositeJsonWriter
java.lang.Object
com.aquima.interactions.foundation.json.writer.CompositeJsonWriter
- All Implemented Interfaces:
IJsonWriter
This class is an IJsonWriter implementation that can combine multiple json writers.
- Since:
- 7.0
- Author:
- Jon van Leuven
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeJsonWriter
(IJsonWriter[] writers) Construct a composite writer with an array of writers.CompositeJsonWriter
(IJsonWriter writer1, IJsonWriter writer2) Create a composite json writer with 2 delegate writers. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this (and its internal) writer.void
End appending an array.void
Begin appending an array.void
writeArrayStart
(String memberName) Begin appending an array with a name.void
writeMember
(String memberName) Appending a member.void
writeMember
(String memberName, boolean booleanValue) Append a member with a boolean value.void
writeMember
(String memberName, double doubleValue) Append a member with a double value.void
writeMember
(String memberName, long longValue) Append a member with a long value.void
writeMember
(String memberName, String strValue) Append a member with a string value.void
Append a member with a null value.void
End appending an object.void
Begin appending an object.void
writeObjectStart
(String memberName) Begin appending an object with a name.void
writeValue
(boolean booleanValue) Append a boolean value.void
writeValue
(double doubleValue) Append a double value.void
writeValue
(long longValue) Append a long value.void
writeValue
(String strValue) Append a string value.void
Append a null value.
-
Constructor Details
-
CompositeJsonWriter
Create a composite json writer with 2 delegate writers.- Parameters:
writer1
- The first writer to delegate all json writer calls to. Will be called before the second writer.writer2
- The second writer to delegate all json writer calls to. Will be called after the first writer.
-
CompositeJsonWriter
Construct a composite writer with an array of writers.- Parameters:
writers
- The writers to delegate all json writer calls to (writers[0] will be called before writers[1], etc)
-
-
Method Details
-
close
Close this (and its internal) writer.- Specified by:
close
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeArrayEnd
End appending an array.- Specified by:
writeArrayEnd
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeArrayStart
Begin appending an array.- Specified by:
writeArrayStart
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeArrayStart
Begin appending an array with a name.- Specified by:
writeArrayStart
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.- Throws:
IOException
- If an I/O error occurs.
-
writeMember
Appending a member.- Specified by:
writeMember
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.- Throws:
IOException
- If an I/O error occurs.
-
writeMember
Append a member with a long value.- Specified by:
writeMember
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.longValue
- The value of the member.- Throws:
IOException
- If an I/O error occurs.
-
writeMember
Append a member with a double value.- Specified by:
writeMember
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.doubleValue
- The value of the member.- Throws:
IOException
- If an I/O error occurs.
-
writeMember
Append a member with a boolean value.- Specified by:
writeMember
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.booleanValue
- The value of the member.- Throws:
IOException
- If an I/O error occurs.
-
writeMember
Append a member with a string value.- Specified by:
writeMember
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.strValue
- The value of the member.- Throws:
IOException
- If an I/O error occurs.
-
writeNull
Append a member with a null value.- Specified by:
writeNull
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.- Throws:
IOException
- If an I/O error occurs.
-
writeObjectEnd
End appending an object.- Specified by:
writeObjectEnd
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeObjectStart
Begin appending an object.- Specified by:
writeObjectStart
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeObjectStart
Begin appending an object with a name.- Specified by:
writeObjectStart
in interfaceIJsonWriter
- Parameters:
memberName
- The member name, may not be null or empty.- Throws:
IOException
- If an I/O error occurs.
-
writeValue
Append a long value.- Specified by:
writeValue
in interfaceIJsonWriter
- Parameters:
longValue
- The value.- Throws:
IOException
- If an I/O error occurs.
-
writeValue
Append a double value.- Specified by:
writeValue
in interfaceIJsonWriter
- Parameters:
doubleValue
- The value.- Throws:
IOException
- If an I/O error occurs.
-
writeValue
Append a boolean value.- Specified by:
writeValue
in interfaceIJsonWriter
- Parameters:
booleanValue
- The value.- Throws:
IOException
- If an I/O error occurs.
-
writeValue
Append a string value.- Specified by:
writeValue
in interfaceIJsonWriter
- Parameters:
strValue
- The value.- Throws:
IOException
- If an I/O error occurs.
-
writeValueNull
Append a null value.- Specified by:
writeValueNull
in interfaceIJsonWriter
- Throws:
IOException
- If an I/O error occurs.
-