public class Parser<RECORD> extends Object implements Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
addDissector(Dissector dissector) |
void |
addDissectors(List<Dissector> dissectors) |
void |
addParseTarget(Method method,
List<String> fieldValues) |
void |
addParseTarget(Method method,
String fieldValue) |
void |
addParseTarget(String setterMethodName,
String fieldValue) |
void |
addTypeRemapping(String input,
String newType) |
void |
addTypeRemapping(String input,
String newType,
EnumSet<Casts> newCasts) |
void |
addTypeRemappings(Map<String,Set<String>> additionalTypeRemappings) |
static String |
cleanupFieldValue(String fieldValue) |
Parsable<RECORD> |
createParsable() |
void |
dropDissector(Class<? extends Dissector> dissectorClassToDrop) |
void |
failOnMissingDissectors()
Reset back to the default of failing on missing dissectors.
|
Map<String,EnumSet<Casts>> |
getAllCasts() |
Set<Dissector> |
getAllDissectors() |
EnumSet<Casts> |
getCasts(String name)
Returns the casts possible for the specified path.
|
Set<String> |
getNeeded() |
List<String> |
getPossiblePaths()
This method is for use by the developer to query the parser about
the possible paths that may be extracted.
|
List<String> |
getPossiblePaths(int maxDepth)
This method is for use by the developer to query the parser about
the possible paths that may be extracted.
|
void |
ignoreMissingDissectors()
This method sets the flag to ignore the missing dissectors situation.
|
RECORD |
parse(RECORD record,
String value)
Parse the value and call all configured setters in the provided instance of RECORD.
|
RECORD |
parse(String value)
Parse the value and return a new instance of RECORD.
|
void |
setRootType(String newRootType) |
void |
setTypeRemappings(Map<String,Set<String>> pTypeRemappings) |
public EnumSet<Casts> getCasts(String name) throws MissingDissectorsException, InvalidDissectorException
Parser<Object> dummyParser= new HttpdLoglineParser<>(Object.class, logformat);
List<String> possiblePaths = dummyParser.getPossiblePaths();
// Use a random method that has the right signature
dummyParser.addParseTarget(String.class.getMethod("indexOf", String.class), possiblePaths);
for (String path : possiblePaths) {
LOG.info("{} {}", path, dummyParser.getCasts(path));
}
name - The name of the path for which you want the castsMissingDissectorsExceptionInvalidDissectorExceptionpublic Map<String,EnumSet<Casts>> getAllCasts() throws MissingDissectorsException, InvalidDissectorException
public final void addDissector(Dissector dissector)
public void setRootType(String newRootType)
public void ignoreMissingDissectors()
public void failOnMissingDissectors()
public void addParseTarget(String setterMethodName, String fieldValue) throws NoSuchMethodException
NoSuchMethodExceptionpublic void addTypeRemapping(String input, String newType, EnumSet<Casts> newCasts)
public RECORD parse(String value) throws DissectionFailure, InvalidDissectorException, MissingDissectorsException
public RECORD parse(RECORD record, String value) throws DissectionFailure, InvalidDissectorException, MissingDissectorsException
public List<String> getPossiblePaths()
public List<String> getPossiblePaths(int maxDepth)
maxDepth - The maximum recursion depthCopyright © 2017. All rights reserved.