コード例 #1
0
 /**
  * Full constructor.
  *
  * @param name the parameter name
  * @param erasureName the qualified name of the parameter's erasure
  * @param typeArgumentNames the qualified names of the parameter's type argument (or empty list)
  * @param annotations the parameter's relevant annotations
  */
 public JavaMethodParameter(
     final String name,
     final SourceType type,
     final List<Annotation> annotations,
     final IResource resource) {
   this.name = name;
   this.type = type;
   this.resource = resource;
   this.annotations = new HashMap<String, Annotation>(annotations.size() * 2);
   for (Annotation annotation : annotations) {
     this.annotations.put(annotation.getFullyQualifiedName(), annotation);
   }
 }
コード例 #2
0
 @Override
 public String toString() {
   final StringBuilder builder = new StringBuilder();
   for (Annotation annotation : annotations.values()) {
     builder.append("@").append(annotation.getJavaAnnotation().getElementName());
     if (annotation.getValue() != null && !annotation.getValue().isEmpty()) {
       builder.append('(').append(annotation.getValue()).append(')');
     }
     builder.append(' ');
   }
   builder.append(getType().getDisplayableTypeName()).append(' ').append(getName());
   return builder.toString();
 }
コード例 #3
0
 public void addAnnotation(Annotation annotation) {
   annotations.put(annotation.getFullyQualifiedName(), annotation);
 }
コード例 #4
0
 public void removeAnnotation(Annotation annotation) {
   annotations.remove(annotation.getFullyQualifiedName());
 }