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 EnumConfiguration
convert(EnumConfiguration enumConfigurationAnnotation)
Convert aEnumConfiguration
into aEnumConfiguration
.EnumValueConfiguration
convert(EnumValueConfiguration enumValueConfigurationAnnotation)
Convert aEnumValueConfiguration
into aEnumValueConfiguration
.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 nameEnumValueConfigurationSizing<java.lang.Integer>
parseCardinality(java.lang.String inputCardinality)
Parse the cardinality expression<T> T
parseSizeValue(EnumValueConfigurationDataType 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 EnumConfiguration convert(EnumConfiguration enumConfigurationAnnotation)
Convert aEnumConfiguration
into aEnumConfiguration
.- Parameters:
enumConfigurationAnnotation
- theEnumConfiguration
.- Returns:
- the
EnumConfiguration
.
-
convert
public EnumValueConfiguration convert(EnumValueConfiguration enumValueConfigurationAnnotation) throws ValidationException
Convert aEnumValueConfiguration
into aEnumValueConfiguration
.- Parameters:
enumValueConfigurationAnnotation
- theEnumValueConfiguration
.- Returns:
- the
EnumValueConfiguration
. - Throws:
ValidationException
- In case if a validation error
-
parseCardinality
public EnumValueConfigurationSizing<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(EnumValueConfigurationDataType 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
-
-