public abstract class AbstractJsonResourceBuilder extends Object implements IResourceBuilder, ToIntFunction<String>
This class deals with the JSON streaming part and invoke the
IResourceTuple.addKeyValue(String, Tuple)
method for each read value.
IResourceBuilder.CompactionType
Constructor and Description |
---|
AbstractJsonResourceBuilder(String hashKey,
boolean lowerCaseKeys)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
int |
applyAsInt(String value)
The callback invoked by the streaming JSON parser.
|
Tuple |
onEnd()
Callback that tells you the scan is done.
|
void |
onStream(Reader in)
Callback for you to stream the remote resource file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onStart, prepare
public AbstractJsonResourceBuilder(String hashKey, boolean lowerCaseKeys)
supplier
- the tuple supplier. It is invoked at every resource loading.isLazy
- true to make the tuple contain only strings, to avoid costly inner tuples. This is backed by special
tuple implementations.hashKey
- the key to be used as a hash key for the resource tuple.lowerCaseKeys
- true to convert all keys to lower casepublic int applyAsInt(String value)
applyAsInt
in interface ToIntFunction<String>
public void onStream(Reader in) throws IOException
IResourceBuilder
onStream
in interface IResourceBuilder
in
- the input stream to consume the resource fileIOException
- in case of IO errorpublic Tuple onEnd()
IResourceBuilder
You should typically free any temporary storage, if any, used to build your resource.
onEnd
in interface IResourceBuilder
Copyright © 2023. All rights reserved.