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);
 }
Exemplo n.º 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()));
      }
    }
  }
Exemplo n.º 3
0
 public Annotation(String typeName) {
   super();
   this.type = AnnotationType.getAnnotationType(typeName);
 }
Exemplo n.º 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);
   }
 }
Exemplo n.º 5
0
 /** {@inheritDoc} */
 public void addAnnotation(AnnotationType annotationType) {
   addAnnotationNoBidirectionalUpdate(annotationType);
   annotationType.addAnnotatedType(this);
 }