org.simantics.databoard.parser
Class DataValuePrinter
java.lang.Object
org.simantics.databoard.parser.DataValuePrinter
- All Implemented Interfaces:
- Binding.Visitor1
public class DataValuePrinter
- extends java.lang.Object
- implements Binding.Visitor1
A class that converts values to their text presentation.
Refereable records are printed after their name. The name is checked
from a data value repository. If the record doesn't exist, a name is
made up and an entry is added.
Names of referable record objects are acquired from a data values repository.
If object is not in the repository, it is added.
- Author:
- Toni Kalajainen
Method Summary |
DataTypeRepository |
getTypeRepository()
|
DataValueRepository |
getValueRepository()
|
void |
print(Binding binding,
java.lang.Object instance)
|
void |
print(MutableVariant variant)
|
void |
setFormat(PrintFormat format)
|
void |
setOutput(java.lang.Appendable out)
|
void |
visit(ArrayBinding b,
java.lang.Object instance)
|
void |
visit(BooleanBinding b,
java.lang.Object instance)
|
void |
visit(ByteBinding b,
java.lang.Object instance)
|
void |
visit(DoubleBinding b,
java.lang.Object instance)
|
void |
visit(FloatBinding b,
java.lang.Object instance)
|
void |
visit(IntegerBinding b,
java.lang.Object instance)
|
void |
visit(LongBinding b,
java.lang.Object instance)
|
void |
visit(MapBinding b,
java.lang.Object entity)
|
void |
visit(OptionalBinding b,
java.lang.Object instance)
|
void |
visit(RecordBinding b,
java.lang.Object instance)
|
void |
visit(StringBinding b,
java.lang.Object instance)
|
void |
visit(UnionBinding b,
java.lang.Object instance)
|
void |
visit(VariantBinding b,
java.lang.Object variant)
|
static java.lang.String |
writeValueMultiLine(Binding type,
java.lang.Object value)
Write value to one or more lines |
static java.lang.String |
writeValueSingleLine(Binding type,
java.lang.Object value)
Serialize value to a single line text string |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DataValuePrinter
public DataValuePrinter(java.lang.Appendable out,
DataValueRepository valueRepository)
writeValueSingleLine
public static java.lang.String writeValueSingleLine(Binding type,
java.lang.Object value)
throws java.io.IOException,
BindingException
- Serialize value to a single line text string
- Parameters:
type
- value
-
- Returns:
- the print
- Throws:
java.io.IOException
BindingException
writeValueMultiLine
public static java.lang.String writeValueMultiLine(Binding type,
java.lang.Object value)
throws java.io.IOException,
BindingException
- Write value to one or more lines
- Parameters:
type
- value
-
- Returns:
- the print
- Throws:
java.io.IOException
BindingException
getValueRepository
public DataValueRepository getValueRepository()
getTypeRepository
public DataTypeRepository getTypeRepository()
setOutput
public void setOutput(java.lang.Appendable out)
setFormat
public void setFormat(PrintFormat format)
print
public void print(MutableVariant variant)
throws java.io.IOException,
BindingException
- Throws:
java.io.IOException
BindingException
print
public void print(Binding binding,
java.lang.Object instance)
throws java.io.IOException,
BindingException
- Throws:
java.io.IOException
BindingException
visit
public void visit(ArrayBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(BooleanBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(DoubleBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(FloatBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(IntegerBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(ByteBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(LongBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(OptionalBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(RecordBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(StringBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(UnionBinding b,
java.lang.Object instance)
throws RuntimeIOException,
RuntimeBindingException
- Specified by:
visit
in interface Binding.Visitor1
- Throws:
RuntimeIOException
RuntimeBindingException
visit
public void visit(MapBinding b,
java.lang.Object entity)
- Specified by:
visit
in interface Binding.Visitor1
visit
public void visit(VariantBinding b,
java.lang.Object variant)
- Specified by:
visit
in interface Binding.Visitor1