Package nl.basjes.parse.core
Class SimpleDissector
- java.lang.Object
-
- nl.basjes.parse.core.Dissector
-
- nl.basjes.parse.core.SimpleDissector
-
- All Implemented Interfaces:
Serializable
public abstract class SimpleDissector extends Dissector
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddissect(Parsable<?> parsable, String inputname)This method must dissect the provided field from the parsable into 'smaller' pieces.abstract voiddissect(Parsable<?> parsable, String inputname, Value value)StringgetInputType()List<String>getPossibleOutput()What are all possible outputs that can be provided.protected voidinitializeNewInstance(Dissector newInstance)This is called after instantiating the class that is actually in the parsetree.EnumSet<Casts>prepareForDissect(String inputname, String outputname)This tells the dissector that it should prepare that we will call it soon with 'inputname' and expect to get 'inputname.outputname' because inputname is of the type returned by getInputType and outputname was part of the answer from getPossibleOutput.voidsetInputType(String nInputType)-
Methods inherited from class nl.basjes.parse.core.Dissector
createAdditionalDissectors, extractFieldName, getNewInstance, initializeFromSettingsParameter, prepareForRun, toString
-
-
-
-
Method Detail
-
getInputType
public String getInputType()
- Specified by:
getInputTypein classDissector- Returns:
- The required typename of the input
-
setInputType
public void setInputType(String nInputType)
- Overrides:
setInputTypein classDissector
-
getPossibleOutput
public List<String> getPossibleOutput()
Description copied from class:DissectorWhat are all possible outputs that can be provided.- Specified by:
getPossibleOutputin classDissector- Returns:
- array of "type:name" values that indicates all the possible outputs. Never a null!
-
prepareForDissect
public EnumSet<Casts> prepareForDissect(String inputname, String outputname)
Description copied from class:DissectorThis tells the dissector that it should prepare that we will call it soon with 'inputname' and expect to get 'inputname.outputname' because inputname is of the type returned by getInputType and outputname was part of the answer from getPossibleOutput. This can be used by the dissector implementation to optimize the internal parsing algorithms and lookup tables and such. The dissector must return the types to which this value can be mapped later on during the run.- Specified by:
prepareForDissectin classDissector- Returns:
- The EnumSet of all allowed casts. Returns an empty EnumSet if nothing is allowed. Never a null !
-
initializeNewInstance
protected void initializeNewInstance(Dissector newInstance) throws InvalidDissectorException
Description copied from class:DissectorThis is called after instantiating the class that is actually in the parsetree.- Overrides:
initializeNewInstancein classDissector- Parameters:
newInstance- The new instances of this class that must be initialized- Throws:
InvalidDissectorException
-
dissect
public final void dissect(Parsable<?> parsable, String inputname) throws DissectionFailure
Description copied from class:DissectorThis method must dissect the provided field from the parsable into 'smaller' pieces.- Specified by:
dissectin classDissector- Throws:
DissectionFailure
-
dissect
public abstract void dissect(Parsable<?> parsable, String inputname, Value value) throws DissectionFailure
- Throws:
DissectionFailure
-
-