use of com.abubusoft.kripton.common.One in project kripton by xcesco.
the class AnnotationUtility method extractAsStringArray.
/**
* Extract from an annotation of a method the attribute value specified.
*
* @param elementUtils
* @param method
* method to analyze
* @param annotationClass
* annotation to analyze
* @param attributeName
* attribute typeName to analyze
* @return attribute value as list of string
*/
public static List<String> extractAsStringArray(ModelMethod method, ModelAnnotation annotationClass, AnnotationAttributeType attribute) {
final Elements elementUtils = BaseProcessor.elementUtils;
final One<List<String>> result = new One<List<String>>();
extractAttributeValue(elementUtils, method.getElement(), annotationClass.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = AnnotationUtility.extractAsArrayOfString(value);
}
});
return result.value0;
}
use of com.abubusoft.kripton.common.One in project kripton by xcesco.
the class AnnotationUtility method extractAsBoolean.
/**
* Estract from an annotation of a method the attribute value specified
*
* @param elementUtils
* @param item
* entity to analyze
* @param annotation
* annotation to analyze
* @param attributeName
* attribute typeName to analyze
*/
public static <E extends ModelEntity<?>> boolean extractAsBoolean(E item, ModelAnnotation annotation, AnnotationAttributeType attribute) {
final Elements elementUtils = BaseProcessor.elementUtils;
final One<Boolean> result = new One<Boolean>(false);
extractAttributeValue(elementUtils, item.getElement(), annotation.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = Boolean.valueOf(value);
}
});
return result.value0;
}
use of com.abubusoft.kripton.common.One in project kripton by xcesco.
the class AnnotationUtility method extractAsEnumerationValue.
/**
* Estract from an annotation of a property the attribute value specified
*
* @param elementUtils
* @param property
* property to analyze
* @param annotationClass
* annotation to analyze
* @param attributeName
* attribute typeName to analyze
* @return attribute value as list of string
*/
public static String extractAsEnumerationValue(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute) {
final Elements elementUtils = BindDataSourceSubProcessor.elementUtils;
final One<String> result = new One<String>();
extractAttributeValue(elementUtils, item, annotationClass.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
if (value.indexOf(".") >= 0)
result.value0 = value.substring(value.lastIndexOf(".") + 1);
}
});
return result.value0;
}
use of com.abubusoft.kripton.common.One in project kripton by xcesco.
the class AnnotationUtility method extractAsClassName.
/**
* Extract from an annotation of a method the attribute value specified.
*
* @param elementUtils
* @param item
* @param annotationClass
* @param attributeName
* @return attribute value extracted as class typeName
*/
public static String extractAsClassName(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attributeName) {
final Elements elementUtils = BindDataSourceSubProcessor.elementUtils;
final One<String> result = new One<String>();
extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = AnnotationUtility.extractAsArrayOfClassName(value).get(0);
}
});
return result.value0;
}
use of com.abubusoft.kripton.common.One in project kripton by xcesco.
the class AnnotationUtility method extractAsString.
/**
* Extract from an annotation of a method the attribute value specified.
*
* @param elementUtils
* @param item
* @param annotationClass
* @param attributeName
* @return attribute value extracted as class typeName
*/
public static String extractAsString(final Element item, final Class<? extends Annotation> annotationClass, final AnnotationAttributeType attributeName) {
final Elements elementUtils = BaseProcessor.elementUtils;
final One<String> result = new One<String>();
extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
List<String> list = AnnotationUtility.extractAsArrayOfString(value);
if (list.size() > 0)
result.value0 = list.get(0);
else
result.value0 = value;
}
});
return result.value0;
}
Aggregations