public final class ConfigUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NO_DEFAULT
The value indicating that no default was specified.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
extendedUncapitalize(java.lang.String str)
Uncapitalize a string with support for leading acronyms.
|
static <T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<?> configInterface,
java.lang.reflect.Method method,
java.lang.Class<T> annotationType,
boolean searchMethodType)
Search for an annotation on a configuration interface method.
|
static java.lang.String |
getDefaultValue(java.lang.Class<?> configInterface,
java.lang.reflect.Method method)
Get the default value of a configuration interface method.
|
static java.lang.Class<?> |
getEnumIdType(java.lang.Class<? extends EnumClass> enumeration)
Returns id type parameter for classes that implement
EnumClass . |
static java.lang.reflect.Method |
getGetMethod(java.lang.Class<?> configInterface,
java.lang.reflect.Method method)
Get the plain get method associated with a configuration interface
method.
|
static java.lang.Class<?> |
getMethodType(java.lang.reflect.Method method)
Get the type of a method.
|
static java.lang.String |
getPropertyName(java.lang.Class<?> configInterface,
java.lang.reflect.Method method)
Get the property name associated with a configuration interface method.
|
static java.lang.String |
getPropertyPrefix(java.lang.Class<?> configInterface)
Get the prefix associated with a configuration interface.
|
static SourceType |
getSourceType(java.lang.Class<?> configInterface,
java.lang.reflect.Method method) |
public static final java.lang.String NO_DEFAULT
public static java.lang.String extendedUncapitalize(java.lang.String str)
str
- The string.public static java.lang.String getPropertyName(java.lang.Class<?> configInterface, java.lang.reflect.Method method)
Property
annotation is present, that value is returned.
Otherwise the interface prefix
is concatenated
with the uncapitalized
property name.configInterface
- The configuration interface.method
- The method.public static java.lang.String getPropertyPrefix(java.lang.Class<?> configInterface)
configInterface
- The configuration interface.public static java.lang.Class<?> getMethodType(java.lang.reflect.Method method)
method
- The method.Void.TYPE
.public static java.lang.reflect.Method getGetMethod(java.lang.Class<?> configInterface, java.lang.reflect.Method method)
configInterface
- The configuration interface.method
- The method.public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<?> configInterface, java.lang.reflect.Method method, java.lang.Class<T> annotationType, boolean searchMethodType)
plain get method
is also searched, as can the method type
be.configInterface
- The configuration interface.method
- The method.annotationType
- The annotation type of interest.searchMethodType
- Whether to search the method type.public static java.lang.String getDefaultValue(java.lang.Class<?> configInterface, java.lang.reflect.Method method)
Default
annotation is present then that string is converted
to the appropriate type using the TypeFactory
class.
Otherwise, for the type Foo, this searches for a FooDefault
annotation. If such an annotation is present then its value is
returned.configInterface
- The configuration interface.method
- The method.public static SourceType getSourceType(java.lang.Class<?> configInterface, java.lang.reflect.Method method)
public static java.lang.Class<?> getEnumIdType(java.lang.Class<? extends EnumClass> enumeration)
EnumClass
.
Id type is usually known for concrete enum classes, but if type is unavailable,
IllegalArgumentException
is thrown.enumeration
- class describing subclass of EnumClass