PersistorToHierarchialString
, those functionalities will be
decoupled from this class.PersistorToHierarchialString
has 2 sub-class PersistorToJSONString
and PersistorToXMLString
.PersistorToJSONFile
and PersistorToXMLFile
will not extends from this class PersistorToHierarchialFile
any more,
they will directly extends the class PersistorToFile
and delegate the 'parse job' (Persistable <--> String)
to class and PersistorToJSONString
and PersistorToXMLString
.@Deprecated public class PersistorToHierarchialFile extends PersistorToFile
filename, ignoredFieldsForUnpickle, persistFile, reader, writer
runtime
Constructor and Description |
---|
PersistorToHierarchialFile(RuntimeDataInterface runtime,
java.lang.String filename)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
childBegin(java.lang.String key,
java.lang.String value)
Deprecated.
This is called inside
write(Persistable) to write "key"
and "value" of a child. |
protected void |
childEnd(boolean lastChild)
Deprecated.
This is called inside
write(Persistable) to write the
end of a child, here a newline "\n" is written. |
protected void |
containerBegin(java.lang.String className)
Deprecated.
This is called inside
write(Persistable) to write the begin
of a container such as:
<tagNam> for XML file
"tagName" : {\n for JSON file
|
protected void |
containerEnd(java.lang.String className)
Deprecated.
This is called inside
write(Persistable) to write the end
of a container such as:
</tagNam> for XML file
} for JSON file. |
protected java.lang.String |
getTagName(java.lang.String className)
Deprecated.
|
protected java.lang.String |
parseFiledValue(java.lang.Object value)
Deprecated.
Parse the parameter value and convert it to a string which will be persisted to (File or Variable or ...)
The following are the ways to parse value: The String value will be PersistorToFile.escape(String) and double-quoted if needed. |
protected void |
write(Persistable persistable)
Deprecated.
Write the Persistable object to a persistence of hierarchical structure, such as JSON, XML file.
This is a template method, it is calling the method below: containerBegin(String)
childBegin(String, String)
childEnd(boolean)
containerEnd(String)
|
beforeUnpickle, doUnpickle, equals, escape, getPersistenceName, getType, isIgnoredFiled, persist, stringNeedQuoted, unpersist, unpickle, writeHeader, writeTailer
validate
public PersistorToHierarchialFile(RuntimeDataInterface runtime, java.lang.String filename)
protected final void write(Persistable persistable) throws SAFSException, java.io.IOException
write
in class PersistorToFile
persistable
- Persistable, the object to persistSAFSException
java.io.IOException
protected java.lang.String getTagName(java.lang.String className)
protected void containerBegin(java.lang.String className) throws java.io.IOException
write(Persistable)
to write the begin
of a container such as:
className
- String, the class name of a container. This is a full class-name, which may needs to
treated to get the simple class name as the tag-name.java.io.IOException
protected void childBegin(java.lang.String key, java.lang.String value) throws java.io.IOException
write(Persistable)
to write "key"
and "value" of a child.key
- String, the key namevalue
- String, the valuejava.io.IOException
protected java.lang.String parseFiledValue(java.lang.Object value)
PersistorToFile.escape(String)
and double-quoted if needed.
value
- Object, the filed's valueSAFSException
protected void childEnd(boolean lastChild) throws java.io.IOException
write(Persistable)
to write the
end of a child, here a newline "\n" is written.lastChild
- boolean, if this is the last child within the container.
it is useful for some file format, such as JSON, if this
is false (not the last child), a comma ,
needs to be added at the end as "key" : "value" ,java.io.IOException
protected void containerEnd(java.lang.String className) throws java.io.IOException
write(Persistable)
to write the end
of a container such as:
className
- String, the tag name, it is normally a container. This is a full class-name, which may needs to
treated to get the simple class name as the tag-name.java.io.IOException
Copyright © SAS Institute. All Rights Reserved.