/** * Get the property name associated with a configuration interface method. * If a {@link Property} annotation is present, that value is returned. * Otherwise the {@link #getPropertyPrefix interface prefix} is concatenated * with the {@link #extendedUncapitalize uncapitalized} property name. * * @param configInterface The configuration interface. * @param method The method. * @return The property name. */ public static String getPropertyName(Class<?> configInterface, Method method) { Property property = getAnnotation(configInterface, method, Property.class, false); if (property != null) { return property.value(); } else { String prefix = getPropertyPrefix(configInterface); String methodName = method.getName(); Matcher matcher; if (((matcher = ACCESS_RE.matcher(methodName)).matches() || (matcher = LISTENER_RE.matcher(methodName)).matches()) && !"".equals(matcher.group(2))) { String prop = matcher.group(2); return prefix + extendedUncapitalize(prop); } else { throw new IllegalArgumentException("Unsupported method name: " + method); } } }