Class Getter

java.lang.Object
io.sundr.model.utils.Getter

public class Getter extends Object
  • Field Details

  • Constructor Details

    • Getter

      public Getter()
  • Method Details

    • findOptional

      public static Optional<Method> findOptional(TypeDef clazz, Field field)
    • find

      public static Method find(TypeDef clazz, Field field)
      Find the getter of the specified field in the type.
      Parameters:
      clazz - The class.
      field - The field.
      Returns:
      The getter method if found. Throws exception if no getter is matched.
    • is

      public static boolean is(Method method)
      Checks if the specified method is a getter.
      Parameters:
      method - The specified method.
      Returns:
      True if getter, false otherwise.
    • is

      public static boolean is(Method method, boolean acceptPrefixless)
      Checks if the specified method is a getter.
      Parameters:
      method - The method.
      acceptPrefixless - Flag to enable support of prefixless getters.
      Returns:
      True if the method is a getter, false otherwise.
    • forField

      public static final Method forField(Field field)
    • name

      public static String name(Field field)
      Return the getter name for the specified Field.
      Parameters:
      field - The field.
      Returns:
      The name.
    • fieldName

      public static String fieldName(Method method)
      Return the field name for the specified getter method.
      Parameters:
      method - The method.
      Returns:
      The name.
    • fieldNameSafe

      public static String fieldNameSafe(Method method)
      Return the field name for the specified getter method. This method will not check if the method is an actual getter and will return the method name if not.
      Parameters:
      method - The method.
      Returns:
      The name, or the method name if method is not a typical getter..
    • prefix

      public static String prefix(Field field)