public abstract class ModelMojoReader<M extends MojoModel>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected M |
_model |
protected MojoReaderBackend |
_reader |
Constructor and Description |
---|
ModelMojoReader() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
exists(java.lang.String name) |
abstract java.lang.String |
getModelName() |
protected abstract M |
makeModel(java.lang.String[] columns,
java.lang.String[][] domains) |
protected byte[] |
readblob(java.lang.String name)
Retrieve binary data previously saved to the mojo file using `writeblob(key, blob)`.
|
static MojoModel |
readFrom(MojoReaderBackend reader) |
protected <T> T |
readkv(java.lang.String key)
Retrieve value from the model's kv store which was previously put there using `writekv(key, value)`.
|
protected <T> T |
readkv(java.lang.String key,
T defVal)
Retrieves the value associated with a given key.
|
protected abstract void |
readModelData() |
protected java.lang.Iterable<java.lang.String> |
readtext(java.lang.String name)
Retrieve text previously saved using `startWritingTextFile` + `writeln` as an array of lines.
|
protected java.lang.Iterable<java.lang.String> |
readtext(java.lang.String name,
boolean unescapeNewlines)
Retrieve text previously saved using `startWritingTextFile` + `writeln` as an array of lines.
|
protected MojoReaderBackend _reader
public static MojoModel readFrom(MojoReaderBackend reader) throws java.io.IOException
java.io.IOException
public abstract java.lang.String getModelName()
protected abstract void readModelData() throws java.io.IOException
java.io.IOException
protected abstract M makeModel(java.lang.String[] columns, java.lang.String[][] domains)
protected <T> T readkv(java.lang.String key)
ParseUtils.tryParse(String, Object)
, which occasionally may get
the answer wrong.
If the `key` is missing in the local kv store, null will be returned. However when assigning to a primitive type
this would result in an NPE, so beware.protected <T> T readkv(java.lang.String key, T defVal)
readkv(String)
. If default value is not null it's type
is used to assist the parser to determine the return type.T
- return typekey
- name of the keydefVal
- default valueprotected byte[] readblob(java.lang.String name) throws java.io.IOException
java.io.IOException
protected boolean exists(java.lang.String name)
protected java.lang.Iterable<java.lang.String> readtext(java.lang.String name) throws java.io.IOException
java.io.IOException
protected java.lang.Iterable<java.lang.String> readtext(java.lang.String name, boolean unescapeNewlines) throws java.io.IOException
java.io.IOException