Package nl.basjes.parse.useragent
Class AbstractUserAgentAnalyzerDirect
java.lang.Object
nl.basjes.parse.useragent.AbstractUserAgentAnalyzerDirect
- All Implemented Interfaces:
Serializable
,Analyzer
,AnalyzerPreHeater
,AnalyzerConfigHolder
- Direct Known Subclasses:
AbstractUserAgentAnalyzer
,UserAgentAnalyzerDirect
public abstract class AbstractUserAgentAnalyzerDirect
extends Object
implements Analyzer, AnalyzerConfigHolder, AnalyzerPreHeater, Serializable
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA extends AbstractUserAgentAnalyzerDirect,
B extends AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA, B>> static class
static class
-
Field Summary
Fields inherited from interface nl.basjes.parse.useragent.AnalyzerPreHeater
LOG, MAX_PRE_HEAT_ITERATIONS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
configure
(AnalyzerConfig pAnalyzerConfig, boolean pShowMatcherStats, boolean pDelayInitialization) static void
configureKryo
(Object kryo) This is used to configure the provided Kryo instance if Kryo serialization is desired.void
destroy()
In some cases it was found that simply dereferencing the instance and letting the GC clean it all up was "too hard".Obtain the config for this analyzer.This function is used only for analyzing which patterns that could possibly be relevant were actually relevant for the matcher actions.protected UserAgentStringMatchMaker
getUsedMatches
(UserAgent.MutableUserAgent userAgent) void
boolean
isSupportedClientHintHeader
(String header) boolean
isWantedField
(String fieldName) void
loadResources
(String resourceString) void
loadResources
(String resourceString, boolean showLoadMessages, boolean optionalResources) Parses and analyzes the provided useragent stringParses and analyzes the provided useragent stringparse
(UserAgent.MutableUserAgent inputUserAgent) Parses and analyzes the useragent string provided in the MutableUserAgent instance.void
reset()
Resets the state of the Analyzer to the default state.void
setVerbose
(boolean newVerbose) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.basjes.parse.useragent.config.AnalyzerConfigHolder
dropTests, getLookups, getLookupSets, getTestCases, getUserAgentMaxLength
Methods inherited from interface nl.basjes.parse.useragent.AnalyzerPreHeater
internalGetTestCasesForPreheat, preHeat, preHeat, preHeat, preHeat
-
Field Details
-
clientHintsAnalyzer
-
-
Constructor Details
-
AbstractUserAgentAnalyzerDirect
protected AbstractUserAgentAnalyzerDirect()
-
-
Method Details
-
getConfig
Description copied from interface:AnalyzerConfigHolder
Obtain the config for this analyzer.- Specified by:
getConfig
in interfaceAnalyzerConfigHolder
- Returns:
- The instance of the config used by this analyzer.
-
getPreheatTestCases
- Specified by:
getPreheatTestCases
in interfaceAnalyzerPreHeater
-
getMatchMaker
-
configureKryo
This is used to configure the provided Kryo instance if Kryo serialization is desired. The expected type here is Object because otherwise the Kryo library becomes a mandatory dependency on any project that uses Yauaa.- Parameters:
kryo
- The instance of com.esotericsoftware.kryo.Kryo that needs to be configured.
-
destroy
public void destroy()In some cases it was found that simply dereferencing the instance and letting the GC clean it all up was "too hard". To assist in these kinds of problem cases this method will wipe the internal data structures as much as possible. After calling this method this instance becomes unusable and cannot be 'repaired'. Normal applications will never need this. Simply dereferencing the analyzer will clean everything, no memory leaks (that we know of). -
loadResources
-
loadResources
public void loadResources(String resourceString, boolean showLoadMessages, boolean optionalResources) -
initializeMatchers
public void initializeMatchers() -
getAllPossibleFieldNames
-
getAllPossibleFieldNamesSorted
-
setVerbose
public void setVerbose(boolean newVerbose) -
reset
public void reset()Resets the state of the Analyzer to the default state. -
parse
Parses and analyzes the provided useragent string -
parse
Parses and analyzes the provided useragent string -
parse
Parses and analyzes the useragent string provided in the MutableUserAgent instance. NOTE: This method is internally synchronized because the way the analyzer works is not reentrant.- Parameters:
inputUserAgent
- The MutableUserAgent instance that is to be parsed and that gets all results- Returns:
- An ImmutableUserAgent copy of the results that is suitable for further usage and caching.
-
supportedClientHintHeaders
-
isSupportedClientHintHeader
-
getAllSupportedHeaders
-
isWantedField
-
getWantedFieldNames
-
configure
protected void configure(AnalyzerConfig pAnalyzerConfig, boolean pShowMatcherStats, boolean pDelayInitialization) -
getMatches
This function is used only for analyzing which patterns that could possibly be relevant were actually relevant for the matcher actions.- Returns:
- The list of Matches that were possibly relevant.
-
getUsedMatches
-
getAllMatchers
-
getTouchedMatchers
-
toString
-