45 final String accessorMethodPrefix;
46 final String propertyNameInAccessorMethod;
49 if (method.getReturnType() == Void.TYPE) {
50 throw new IllegalArgumentException(
51 "Invalid accessor method, must have return value if starts with 'get'. Method: " + method);
52 }
else if (method.getParameterTypes().length > 0) {
53 throw new IllegalArgumentException(
54 "Invalid accessor method, must have zero arguments if starts with 'get'. Method: " + method);
59 if (method.getReturnType() != Void.TYPE) {
60 throw new IllegalArgumentException(
61 "Invalid accessor method, must not have return value if starts with 'set'. Method: " + method);
62 }
else if (method.getParameterTypes().length != 1) {
63 throw new IllegalArgumentException(
64 "Invalid accessor method, must have one argument if starts with 'set'. Method: " + method);
69 if (method.getReturnType() != Boolean.TYPE || !method.getReturnType().isPrimitive()) {
70 throw new IllegalArgumentException(
71 "Invalid accessor method, must return boolean primitive if starts with 'is'. Method: " +
77 throw new IllegalArgumentException(
78 "Invalid accessor method, must start with 'get', 'set' or 'is'. " +
"Method: " + method);
81 if (propertyNameInAccessorMethod.length() == 0 ||
82 !Character.isUpperCase(propertyNameInAccessorMethod.charAt(0))) {
83 throw new IllegalArgumentException(
"Invalid accessor method, prefix '" + accessorMethodPrefix +
84 "' must be followed a non-empty property name, capitalized. Method: " + method);
87 this.
propertyName = Introspector.decapitalize(propertyNameInAccessorMethod);
final String propertyName
Definition: MethodPropertyImpl.java:41
static Method getSetterMethod(Class<?> clazz, String name)
Definition: MethodPropertyImpl.java:150
static Method getGetterMethod(Class<?> clazz, String name)
Definition: MethodPropertyImpl.java:163
static final int GETTER_METHOD_PREFIX_LENGTH
Definition: MethodPropertyImpl.java:36
final Method setterMethod
Definition: MethodPropertyImpl.java:42
static final int BOOLEAN_GETTER_METHOD_PREFIX_LENGTH
Definition: MethodPropertyImpl.java:38
static final String BOOLEAN_GETTER_METHOD_PREFIX
Definition: MethodPropertyImpl.java:34
final Method getterMethod
Definition: MethodPropertyImpl.java:40
static final int SETTER_METHOD_PREFIX_LENGTH
Definition: MethodPropertyImpl.java:37
static final String SETTER_METHOD_PREFIX
Definition: MethodPropertyImpl.java:33
static final String GETTER_METHOD_PREFIX
Definition: MethodPropertyImpl.java:32