All Implemented Interfaces:
FromSourceLocation, ToNode, TypeCheck, ToCondition, ToExpression

public final class IsValidHostLabel extends LibraryFunction
A rule-engine function for checking whether a string is a valid DNS host label.
  • Field Details

  • Method Details

    • getDefinition

      public static IsValidHostLabel.Definition getDefinition()
      Gets the FunctionDefinition implementation.
      Returns:
      the function definition.
    • ofExpressions

      public static IsValidHostLabel ofExpressions(ToExpression arg1, ToExpression arg2)
      Creates a IsValidHostLabel function from the given expressions.
      Parameters:
      arg1 - the value to check.
      arg2 - whether to allow subdomains.
      Returns:
      The resulting IsValidHostLabel function.
    • ofExpressions

      public static IsValidHostLabel ofExpressions(ToExpression arg1, boolean arg2)
      Creates a IsValidHostLabel function from the given expressions.
      Parameters:
      arg1 - the value to check.
      arg2 - whether to allow subdomains.
      Returns:
      The resulting IsValidHostLabel function.
    • accept

      public <T> T accept(ExpressionVisitor<T> visitor)
      Description copied from class: Expression
      Invoke the ExpressionVisitor functions for this expression.
      Specified by:
      accept in class Expression
      Type Parameters:
      T - the visitor return type.
      Parameters:
      visitor - the visitor to be invoked.
      Returns:
      the return value of the visitor.
    • isValidHostLabel

      public static boolean isValidHostLabel(String hostLabel, boolean allowDots)
      Check if a hostLabel is valid.
      Parameters:
      hostLabel - Host label to check.
      allowDots - Set to true to allow dots as separators.
      Returns:
      true if the label is valid.