private <A extends Annotation> Annotation createAnnotation(
     AnnotationType annotationType, Class<A> returnType) {
   AnnotationDescriptor<A> annotationDescriptor = new AnnotationDescriptor<A>(returnType);
   for (ElementType elementType : annotationType.getElement()) {
     String name = elementType.getName();
     Class<?> parameterType = getAnnotationParameterType(returnType, name);
     Object elementValue = getElementValue(elementType, parameterType);
     annotationDescriptor.setValue(name, elementValue);
   }
   return AnnotationFactory.create(annotationDescriptor);
 }
Exemple #2
0
  @Override
  public void populate(final Map<String, Serializable> propertiesMap) {

    super.populate(propertiesMap); // let base class handle primitives, etc.

    // correctly convert aggregate type
    if (propertiesMap.containsKey(AGGREGATE_TYPE_ID)) {
      Serializable value = propertiesMap.get(AGGREGATE_TYPE_ID);
      if (value != null) {
        setAggregateType(AggregationType.valueOf(value.toString()));
      }
    }
  }
 public Annotation(String typeName) {
   super();
   this.type = AnnotationType.getAnnotationType(typeName);
 }
Exemple #4
0
 /**
  * Removes any existing reference of this object from all the references.
  *
  * <p>Sub-classes should override to add their own removals.
  */
 public void removeReferences() {
   for (AnnotationType annotationType : getAnnotations()) {
     annotationType.removeAnnotatedType(this);
   }
 }
Exemple #5
0
 /** {@inheritDoc} */
 public void addAnnotation(AnnotationType annotationType) {
   addAnnotationNoBidirectionalUpdate(annotationType);
   annotationType.addAnnotatedType(this);
 }