Пример #1
0
 public static AnnotationValue[] toArray(List<AnnotationValue> list) {
   AnnotationValue[] values = EMPTY_ANNOTATION_VALUE_ARRAY;
   if (CollectionHelper.isNotEmpty(list)) {
     values = list.toArray(new AnnotationValue[list.size()]);
   }
   return values;
 }
Пример #2
0
 /**
  * util method for String Array attribute Annotation
  *
  * @param name
  * @param values
  * @param annotationValueList
  */
 static void stringArrayValue(
     String name, List<String> values, List<AnnotationValue> annotationValueList) {
   if (CollectionHelper.isNotEmpty(values)) {
     AnnotationValue[] annotationValues = new AnnotationValue[values.size()];
     for (int j = 0; j < values.size(); j++) {
       annotationValues[j] = stringValue("", values.get(j));
     }
     annotationValueList.add(AnnotationValue.createArrayValue(name, annotationValues));
   }
 }
Пример #3
0
  static void enumArrayValue(
      String name, DotName typeName, List<Enum> valueList, List<AnnotationValue> list) {
    if (CollectionHelper.isNotEmpty(valueList)) {

      List<AnnotationValue> enumValueList = new ArrayList<AnnotationValue>(valueList.size());
      for (Enum e : valueList) {
        addToCollectionIfNotNull(enumValueList, enumValue("", typeName, e));
      }
      list.add(AnnotationValue.createArrayValue(name, toArray(enumValueList)));
    }
  }
Пример #4
0
  static void classArrayValue(
      String name,
      List<String> classNameList,
      List<AnnotationValue> list,
      ServiceRegistry serviceRegistry) {
    if (CollectionHelper.isNotEmpty(classNameList)) {

      List<AnnotationValue> clazzValueList = new ArrayList<AnnotationValue>(classNameList.size());
      for (String clazz : classNameList) {
        addToCollectionIfNotNull(clazzValueList, classValue("", clazz, serviceRegistry));
      }

      list.add(AnnotationValue.createArrayValue(name, toArray(clazzValueList)));
    }
  }