Class AnnotationConvertUtil
- java.lang.Object
-
- com.github.toolarium.enumeration.configuration.util.AnnotationConvertUtil
-
public final class AnnotationConvertUtil extends java.lang.Object
Annotation convert utility
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends EnumKeyConfiguration>
EnumConfiguration<T>convert(EnumConfiguration enumConfigurationAnnotation)
Convert aEnumConfiguration
into aEnumConfiguration
.EnumKeyConfiguration
convert(EnumKeyConfiguration enumKeyConfigurationAnnotation)
Convert aEnumKeyValueConfiguration
into aEnumKeyValueConfiguration
.EnumKeyValueConfiguration
convert(EnumKeyValueConfiguration enumKeyValueConfigurationAnnotation)
Convert aEnumKeyValueConfiguration
into aEnumKeyValueConfiguration
.static AnnotationConvertUtil
getInstance()
Get the instance<T extends javax.lang.model.element.ExecutableElement>
java.lang.StringgetName(T type)
Get the name<T extends javax.lang.model.element.AnnotationValue>
java.lang.StringgetValue(T type)
Get the nameEnumKeyValueConfigurationSizing<java.lang.Integer>
parseCardinality(java.lang.String inputCardinality)
Parse the cardinality expression<T> T
parseSizeValue(EnumKeyValueConfigurationDataType dataType, java.lang.String input)
Parse the size valuejava.lang.String
trimQuotationMarks(java.lang.String input)
Trim quotation marks
-
-
-
Method Detail
-
getInstance
public static AnnotationConvertUtil getInstance()
Get the instance- Returns:
- the instance
-
convert
public <T extends EnumKeyConfiguration> EnumConfiguration<T> convert(EnumConfiguration enumConfigurationAnnotation)
Convert aEnumConfiguration
into aEnumConfiguration
.- Type Parameters:
T
- The generic type- Parameters:
enumConfigurationAnnotation
- theEnumConfiguration
.- Returns:
- the
EnumConfiguration
.
-
convert
public EnumKeyConfiguration convert(EnumKeyConfiguration enumKeyConfigurationAnnotation) throws ValidationException
Convert aEnumKeyValueConfiguration
into aEnumKeyValueConfiguration
.- Parameters:
enumKeyConfigurationAnnotation
- theEnumKeyConfiguration
.- Returns:
- the
EnumKeyValueConfiguration
. - Throws:
ValidationException
- In case if a validation error
-
convert
public EnumKeyValueConfiguration convert(EnumKeyValueConfiguration enumKeyValueConfigurationAnnotation) throws ValidationException
Convert aEnumKeyValueConfiguration
into aEnumKeyValueConfiguration
.- Parameters:
enumKeyValueConfigurationAnnotation
- theEnumKeyValueConfiguration
.- Returns:
- the
EnumKeyValueConfiguration
. - Throws:
ValidationException
- In case if a validation error
-
parseCardinality
public EnumKeyValueConfigurationSizing<java.lang.Integer> parseCardinality(java.lang.String inputCardinality)
Parse the cardinality expression- Parameters:
inputCardinality
- the cardinality- Returns:
- the parsed cardinality
-
parseSizeValue
public <T> T parseSizeValue(EnumKeyValueConfigurationDataType dataType, java.lang.String input)
Parse the size value- Type Parameters:
T
- the generic type- Parameters:
dataType
- the data typeinput
- the string input, either number or *. In case it's null it will return null- Returns:
- the parsed result
-
getName
public <T extends javax.lang.model.element.ExecutableElement> java.lang.String getName(T type)
Get the name- Type Parameters:
T
- the generic type- Parameters:
type
- the type- Returns:
- the type as name
-
getValue
public <T extends javax.lang.model.element.AnnotationValue> java.lang.String getValue(T type)
Get the name- Type Parameters:
T
- the generic type- Parameters:
type
- the type- Returns:
- the type as name
-
trimQuotationMarks
public java.lang.String trimQuotationMarks(java.lang.String input)
Trim quotation marks- Parameters:
input
- the input- Returns:
- the trimmed output
-
-