Class AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA extends AbstractUserAgentAnalyzerDirect,B extends AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA,B>>

java.lang.Object
nl.basjes.parse.useragent.AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA,B>
Direct Known Subclasses:
AbstractUserAgentAnalyzer.AbstractUserAgentAnalyzerBuilder, UserAgentAnalyzerDirect.UserAgentAnalyzerDirectBuilder
Enclosing class:
AbstractUserAgentAnalyzerDirect

public abstract static class AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA extends AbstractUserAgentAnalyzerDirect,B extends AbstractUserAgentAnalyzerDirect.AbstractUserAgentAnalyzerDirectBuilder<UAA,B>> extends Object
  • Constructor Details

    • AbstractUserAgentAnalyzerDirectBuilder

      protected AbstractUserAgentAnalyzerDirectBuilder(UAA newUaa)
  • Method Details

    • failIfAlreadyBuilt

      protected void failIfAlreadyBuilt()
    • dropDefaultResources

      public B dropDefaultResources()
      Drop the default set of rules. Useful in parsing ONLY company specific useragents.
      Returns:
      the current Builder instance.
    • addResources

      public B addResources(String resourceString)
      Add a set of additional rules. Useful in handling specific cases.
      Parameters:
      resourceString - The resource list that needs to be added.
      Returns:
      the current Builder instance.
    • addOptionalResources

      public B addOptionalResources(String resourceString)
      Add a set of additional rules. Useful in handling specific cases. The startup will continue even if these do not exist.
      Parameters:
      resourceString - The resource list that should to be added.
      Returns:
      the current Builder instance.
    • addYamlRule

      public B addYamlRule(String yamlRule)
      Add a set of additional rules. Useful in handling specific cases. The startup will continue even if these do not exist.
      Parameters:
      yamlRule - The Yaml expression that should to be added.
      Returns:
      the current Builder instance.
    • preheat

      public B preheat(int iterations)
      Use the available testcases to preheat the jvm on this analyzer.
      Parameters:
      iterations - How many testcases must be run
      Returns:
      the current Builder instance.
    • preheat

      public B preheat()
      Use the available testcases to preheat the jvm on this analyzer. All available testcases will be run exactly once.
      Returns:
      the current Builder instance.
    • withField

      public B withField(String fieldName)
      Specify an additional field that we want to retrieve.
      Parameters:
      fieldName - The name of the additional field
      Returns:
      the current Builder instance.
    • withFields

      public B withFields(Collection<String> fieldNames)
      Specify a set of additional fields that we want to retrieve.
      Parameters:
      fieldNames - The collection of names of the additional fields
      Returns:
      the current Builder instance.
    • withFields

      public B withFields(String... fieldNames)
      Specify a set of additional fields that we want to retrieve.
      Parameters:
      fieldNames - The array of names of the additional fields
      Returns:
      the current Builder instance.
    • withAllFields

      public B withAllFields()
      Specify that we simply want to retrieve all possible fields.
      Returns:
      the current Builder instance.
    • showMatcherLoadStats

      public B showMatcherLoadStats()
      Log additional information during the startup of the analyzer.
      Returns:
      the current Builder instance.
    • hideMatcherLoadStats

      public B hideMatcherLoadStats()
      Set the stats logging during the startup of the analyzer back to the default of "minimal".
      Returns:
      the current Builder instance.
    • withUserAgentMaxLength

      public B withUserAgentMaxLength(int newUserAgentMaxLength)
      Set maximum length of a useragent for it to be classified as Hacker without any analysis.
      Parameters:
      newUserAgentMaxLength - The new maximum length of a useragent for it to be classified as Hacker without any analysis.
      Returns:
      the current Builder instance.
    • keepTests

      public B keepTests()
      Retain all testcases in memory after initialization.
      Returns:
      the current Builder instance.
    • dropTests

      public B dropTests()
      Remove all testcases in memory after initialization.
      Returns:
      the current Builder instance.
    • delayInitialization

      public B delayInitialization()
      Load all patterns and rules but do not yet build the lookup hashMaps yet. For the engine to run these lookup hashMaps are needed so they will be constructed once "just in time".
      Returns:
      the current Builder instance.
    • immediateInitialization

      public B immediateInitialization()
      Load all patterns and rules and immediately build the lookup hashMaps.
      Returns:
      the current Builder instance.
    • showMinimalVersion

      public B showMinimalVersion()
    • showFullVersion

      public B showFullVersion()
    • build

      public UAA build()
      Construct the analyzer and run the preheat sequence (if requested).
      Returns:
      the new analyzer instance.