Package io.sundr.model.utils
Class Getter
- java.lang.Object
-
- io.sundr.model.utils.Getter
-
public class Getter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringGET_PREFIXstatic StringIS_PREFIXstatic StringSHOULD_PREFIXstatic io.sundr.model.VoidRefVOID
-
Constructor Summary
Constructors Constructor Description Getter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.sundr.model.Methodfind(io.sundr.model.TypeDef clazz, io.sundr.model.Property property)Find the getter of the specified property in the type.static io.sundr.model.Methodfind(io.sundr.model.TypeDef clazz, io.sundr.model.Property property, boolean acceptPrefixless)Find the getter of the specified property in the type.static Optional<io.sundr.model.Method>findOptional(io.sundr.model.TypeDef clazz, io.sundr.model.Property property)static io.sundr.model.MethodforProperty(io.sundr.model.Property property)static booleanis(io.sundr.model.Method method)Checks if the specified method is a getter.static booleanis(io.sundr.model.Method method, boolean acceptPrefixless)Checks if the specified method is a getter.static Stringname(io.sundr.model.Property property)Return the getter name for the specifiedProperty.static Stringprefix(io.sundr.model.Property property)static StringpropertyName(io.sundr.model.Method method)Return the property name for the specified gettermethod.static StringpropertyNameSafe(io.sundr.model.Method method)Return the property name for the specified gettermethod.
-
-
-
Field Detail
-
GET_PREFIX
public static final String GET_PREFIX
- See Also:
- Constant Field Values
-
IS_PREFIX
public static final String IS_PREFIX
- See Also:
- Constant Field Values
-
SHOULD_PREFIX
public static final String SHOULD_PREFIX
- See Also:
- Constant Field Values
-
VOID
public static final io.sundr.model.VoidRef VOID
-
-
Method Detail
-
find
public static io.sundr.model.Method find(io.sundr.model.TypeDef clazz, io.sundr.model.Property property)Find the getter of the specified property in the type.- Parameters:
clazz- The class.property- The property.- Returns:
- The getter method if found. Throws exception if no getter is matched.
-
findOptional
public static Optional<io.sundr.model.Method> findOptional(io.sundr.model.TypeDef clazz, io.sundr.model.Property property)
-
find
public static io.sundr.model.Method find(io.sundr.model.TypeDef clazz, io.sundr.model.Property property, boolean acceptPrefixless)Find the getter of the specified property in the type.- Parameters:
clazz- The class.property- The property.acceptPrefixless- Flag to accept prefixless getters.- Returns:
- The getter method if found. Throws exception if no getter is matched.
-
is
public static boolean is(io.sundr.model.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(io.sundr.model.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:
-
forProperty
public static final io.sundr.model.Method forProperty(io.sundr.model.Property property)
-
name
public static String name(io.sundr.model.Property property)
Return the getter name for the specifiedProperty.- Parameters:
property- The property.- Returns:
- The name.
-
propertyName
public static String propertyName(io.sundr.model.Method method)
Return the property name for the specified gettermethod.- Parameters:
method- The method.- Returns:
- The name.
-
propertyNameSafe
public static String propertyNameSafe(io.sundr.model.Method method)
Return the property name for the specified gettermethod. 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(io.sundr.model.Property property)
-
-