private Method findSetter(MetaData md) throws DataLinkException { Object method = setters.get(md.getName()); if (method == NULLMETHOD) { throw new DataLinkException("Setter not found for field: " + md.getName() + "."); } else if (method == null) { for (Method m : clazz.getMethods()) { if (m.getParameterTypes().length == 1 && m.getName().equals(getSetterName(md))) { setters.put(md.getName(), m); return m; } } setters.put(md.getName(), NULLMETHOD); throw new DataLinkException("Setter not found for field: " + md.getName() + "."); } else { return (Method) method; } }
private String getGetterName(MetaData md) { return (Kind.BOOLEAN == md.getKind() ? "is" : "get") + Character.toUpperCase(md.getName().charAt(0)) + md.getName().substring(1); }
private String getSetterName(MetaData md) { return "set" + Character.toUpperCase(md.getName().charAt(0)) + md.getName().substring(1); }