コード例 #1
0
 private static <R, V> Method generateSetter(
     String prop, Class pRowClass, PropertyColumn<R, V> column) throws NoSuchMethodException {
   Class aClass = column.getColumnClass();
   String methodName = deriveMethodName("set", prop); // NON-NLS
   Method method = pRowClass.getMethod(methodName, aClass);
   //noinspection StringConcatenation,MagicCharacter
   assert method.getParameterTypes().length == 1
       : "Incorrect number of parameters for setter method " + pRowClass + '.' + methodName;
   //noinspection StringConcatenation
   assert verifyReturn(aClass, method.getParameterTypes()[0])
       : "Incorrect parameter type: " + aClass;
   return method;
 }
コード例 #2
0
 private static <R, V> Method generateGetter(
     String prop, Class pRowClass, PropertyColumn<R, V> column) throws NoSuchMethodException {
   Class aClass = column.getColumnClass();
   String prefix = aClass == Boolean.class ? "is" : "get"; // NON-NLS
   String methodName = deriveMethodName(prefix, prop);
   Method method = pRowClass.getMethod(methodName);
   //noinspection StringConcatenation,MagicCharacter,HardcodedLineSeparator
   assert verifyReturn(aClass, method.getReturnType())
       : "Incorrect Return Type for getter method "
           + pRowClass
           + '.'
           + methodName
           + "\n\tExpected "
           + aClass
           + "\n\tFound "
           + method.getReturnType();
   return method;
 }