public interface OdinFieldWriter
Modifier and Type | Method and Description |
---|---|
void |
with(java.lang.Object o)
Write object to the current field without a generic type.
|
void |
withBoolean(boolean value)
Write a boolean to the current field
|
void |
withByte(byte value)
Write a byte to the current field
|
void |
withChar(char value)
Write a char to the current field
|
void |
withDouble(double value)
Write a double to the current field
|
void |
withFloat(float value)
Write a float to the current field
|
void |
withInt(int value)
Write a int to the current field
|
void |
withLong(long value)
Write a long to the current field
|
void |
withShort(short value)
Write a short to the current field
|
void |
withString(java.lang.String value)
Write a String to the current field
|
void |
withSubContent(IOConsumer<OdinWriter> subWriter)
Use a consumer to write content to a sub object.
|
void |
withTyped(java.lang.Object o,
java.lang.reflect.Type type)
Write an object to the current field, odin get the
AnyType associated to the given type, if the object class is not the same than type class, like implementation,
the type name is added before the object.Custom type can be created to add generic argument ( can be useful for collection ) using TypeBuilder . |
<T> void |
withTyped(T o,
AnyType<T> type)
Write an object to the current field, if object class is not the same than type class, like implementation, the type name is added before the object.
This method take a odin type to be use inside adapter by using ObjectType.getField(String) or all other field getter and
TypeField.getType() |
void withBoolean(boolean value) throws java.io.IOException
value
- boolean to writejava.io.IOException
- if an IO exception occurvoid withByte(byte value) throws java.io.IOException
value
- byte to writejava.io.IOException
- if an IO exception occurvoid withShort(short value) throws java.io.IOException
value
- short to writejava.io.IOException
- if an IO exception occurvoid withInt(int value) throws java.io.IOException
value
- int to writejava.io.IOException
- if an IO exception occurvoid withLong(long value) throws java.io.IOException
value
- long to writejava.io.IOException
- if an IO exception occurvoid withFloat(float value) throws java.io.IOException
value
- float to writejava.io.IOException
- if an IO exception occurvoid withDouble(double value) throws java.io.IOException
value
- double to writejava.io.IOException
- if an IO exception occurvoid withChar(char value) throws java.io.IOException
value
- char to writejava.io.IOException
- if an IO exception occurvoid withString(java.lang.String value) throws java.io.IOException
value
- String to writejava.io.IOException
- if an IO exception occurvoid with(java.lang.Object o) throws java.io.IOException
o
- object to writejava.io.IOException
- if an IO exception occurOdinTypeException
- if the type adapter can not be build for this object.
Sub object type error is placed as cause of a OdinAdapterException
OdinAdapterException
- if a runtime exception is throw by an adapter when writing the object<T> void withTyped(T o, AnyType<T> type) throws java.io.IOException
ObjectType.getField(String)
or all other field getter and
TypeField.getType()
T
- object generic typeo
- object to writetype
- object generic typejava.io.IOException
- if an IO exception occurOdinTypeException
- if the type adapter can not be build for this object.
Sub object type error is placed as cause of a OdinAdapterException
OdinAdapterException
- if a runtime exception is throw by an adapter when writing the objectvoid withTyped(java.lang.Object o, java.lang.reflect.Type type) throws java.io.IOException
AnyType
associated to the given type, if the object class is not the same than type class, like implementation,
the type name is added before the object.TypeBuilder
.o
- object to writetype
- object typejava.io.IOException
- if an IO exception occurOdinTypeException
- if the type adapter can not be build for this object.
Sub object type error is placed as cause of a OdinAdapterException
OdinAdapterException
- if a runtime exception is throw by an adapter when writing the objectvoid withSubContent(IOConsumer<OdinWriter> subWriter) throws java.io.IOException
subWriter
- the sub writer consumerjava.io.IOException
- if an IO exception occur