Package org.coliper.ibean.beanstyle
Class ClassicBeanStyleWithOptionalSupport
- java.lang.Object
-
- org.coliper.ibean.BeanStyle
-
- org.coliper.ibean.beanstyle.ClassicBeanStyle
-
- org.coliper.ibean.beanstyle.ClassicBeanStyleWithOptionalSupport
-
public class ClassicBeanStyleWithOptionalSupport extends ClassicBeanStyle
ABeanStyleimplementation that is identical to theClassicBeanStylebut has alsoOptionalsupport. The difference to theClassicBeanStyleis that for a property of typeTit allows a getter method that either returnsTorOptional<T>.
-
-
Field Summary
Fields Modifier and Type Field Description static ClassicBeanStyleWithOptionalSupportINSTANCE-
Fields inherited from class org.coliper.ibean.BeanStyle
CLASSIC, CLASSIC_WITH_OPTIONAL, MODERN
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedClassicBeanStyleWithOptionalSupport()INSTANCEshould be the only instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>determineFieldTypeFromGetterAndSetter(Class<?> beanType, Method getterMethod, Method setterMethod)Determines the type of a bean field from given corresponding getter and setter method.-
Methods inherited from class org.coliper.ibean.beanstyle.ClassicBeanStyle
convertGetterNameToFieldName, convertSetterNameToFieldName, hasGetterMethodSignature, hasSetterMethodSignature, isGetterMethod, isSetterMethod
-
Methods inherited from class org.coliper.ibean.BeanStyle
assertForBeanType, equals, hashCode, isNoParameterInMethod, isOneParameterInMethod
-
-
-
-
Field Detail
-
INSTANCE
public static final ClassicBeanStyleWithOptionalSupport INSTANCE
-
-
Constructor Detail
-
ClassicBeanStyleWithOptionalSupport
protected ClassicBeanStyleWithOptionalSupport()
INSTANCEshould be the only instance.
-
-
Method Detail
-
determineFieldTypeFromGetterAndSetter
public Class<?> determineFieldTypeFromGetterAndSetter(Class<?> beanType, Method getterMethod, Method setterMethod) throws InvalidIBeanTypeException
Description copied from class:BeanStyleDetermines the type of a bean field from given corresponding getter and setter method. Implementations of this method can assume that both given methods have been checked for getter and setter compliance and that both methods match in terms of method names. Implementations need to determine the type of the field and need to check if both getter and setter match to the type. That means that for example not only the given setter should be looked at to find out the field type.- Overrides:
determineFieldTypeFromGetterAndSetterin classClassicBeanStyle- Parameters:
beanType- the examined bean classgetterMethod- a method of thebeanTypethat is proven to be a potential gettersetterMethod- a method of thebeanTypethat is proven to be a potential setter- Returns:
- the type of the bean field
- Throws:
InvalidIBeanTypeException- if either the type cannot be determined for any reason or if the concluded types of setter and getter do not match
-
-