Class ElementInfoPredicates

java.lang.Object
io.helidon.codegen.ElementInfoPredicates

public final class ElementInfoPredicates extends Object
Commonly used predicates to filter typed element info.
See Also:
  • Field Details

  • Method Details

    • isMethod

      public static boolean isMethod(TypedElementInfo element)
      Predicate for method element kind.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element represents a method
    • isField

      public static boolean isField(TypedElementInfo element)
      Predicate for field element kind.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element represents a field
    • isStatic

      public static boolean isStatic(TypedElementInfo element)
      Predicate for static modifier.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has static modifier
    • isPrivate

      public static boolean isPrivate(TypedElementInfo element)
      Predicate for private modifier.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has private modifier
    • isPublic

      public static boolean isPublic(TypedElementInfo element)
      Predicate for public modifier.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has public modifier
    • isDefault

      public static boolean isDefault(TypedElementInfo element)
      Predicate for default modifier (default methods on interfaces).
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has default modifier
    • isVoid

      public static boolean isVoid(TypedElementInfo element)
      Predicate for void methods.
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has void return type (both primitive and boxed)
    • hasNoArgs

      public static boolean hasNoArgs(TypedElementInfo element)
      Predicate for element with no arguments (suitable for methods).
      Parameters:
      element - typed element info to test
      Returns:
      whether the element has no arguments
    • hasAnnotation

      public static Predicate<TypedElementInfo> hasAnnotation(TypeName annotation)
      Predicate for an existence of an annotation.
      Parameters:
      annotation - Annotation to check for
      Returns:
      a new predicate for the provided annotation
    • elementName

      public static Predicate<TypedElementInfo> elementName(String name)
      Predicate for element name (such as method name, or field name).
      Parameters:
      name - name of the element to check for
      Returns:
      a new predicate for the provided element name
    • hasParams

      public static Predicate<TypedElementInfo> hasParams(TypeName... paramTypes)
      Predicate for element with the specified parameters types (suitable for methods). The method must have exactly the same number and types of parameters.
      Parameters:
      paramTypes - expected parameter types
      Returns:
      a new predicate for the provided parameter types
    • hasParams

      public static Predicate<TypedElementInfo> hasParams(List<TypeName> paramTypes)
      Predicate for element with the specified parameters types (suitable for methods). The method must have exactly the same number and types of parameters.
      Parameters:
      paramTypes - expected parameter types
      Returns:
      a new predicate for the provided parameter types