public class Parser<RECORD> extends Object implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Parser.SetterPolicy |
| Modifier and Type | Method and Description |
|---|---|
Parser<RECORD> |
addDissector(Dissector dissector) |
Parser<RECORD> |
addDissectors(List<Dissector> dissectors) |
Parser<RECORD> |
addParseTarget(Method method,
List<String> fieldValues) |
Parser<RECORD> |
addParseTarget(Method method,
Parser.SetterPolicy setterPolicy,
List<String> fieldValues) |
Parser<RECORD> |
addParseTarget(Method method,
Parser.SetterPolicy setterPolicy,
String fieldValue) |
Parser<RECORD> |
addParseTarget(Method method,
String fieldValue) |
Parser<RECORD> |
addParseTarget(String setterMethodName,
Parser.SetterPolicy setterPolicy,
String fieldValue) |
Parser<RECORD> |
addParseTarget(String setterMethodName,
String fieldValue) |
Parser<RECORD> |
addTypeRemapping(String input,
String newType) |
Parser<RECORD> |
addTypeRemapping(String input,
String newType,
EnumSet<Casts> newCasts) |
Parser<RECORD> |
addTypeRemappings(Map<String,Set<String>> additionalTypeRemappings) |
static String |
cleanupFieldValue(String fieldValue) |
Parsable<RECORD> |
createParsable() |
Parser<RECORD> |
dropDissector(Class<? extends Dissector> dissectorClassToDrop) |
Parser<RECORD> |
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.
|
Parser<RECORD> |
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.
|
Parser<RECORD> |
setRootType(String newRootType) |
Parser<RECORD> |
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 Parser<RECORD> dropDissector(Class<? extends Dissector> dissectorClassToDrop)
public Parser<RECORD> ignoreMissingDissectors()
public Parser<RECORD> failOnMissingDissectors()
public Parser<RECORD> addParseTarget(String setterMethodName, String fieldValue) throws NoSuchMethodException
NoSuchMethodExceptionpublic Parser<RECORD> addParseTarget(String setterMethodName, Parser.SetterPolicy setterPolicy, String fieldValue) throws NoSuchMethodException
NoSuchMethodExceptionpublic Parser<RECORD> addParseTarget(Method method, Parser.SetterPolicy setterPolicy, String fieldValue)
public Parser<RECORD> addParseTarget(Method method, Parser.SetterPolicy setterPolicy, List<String> fieldValues)
public Parser<RECORD> addTypeRemappings(Map<String,Set<String>> additionalTypeRemappings)
public Parser<RECORD> 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 © 2019. All rights reserved.