Package org.codehaus.jam.mutable

Examples of org.codehaus.jam.mutable.MAnnotation


  // Protected methods

  protected MAnnotation[] createAnnotations(MAnnotatedElement target, Tag tag) {
    String tagName = tag.name().trim().substring(1);
    //MAnnotation out = target.addAnnotation(tagName);
    MAnnotation current = target.getMutableAnnotation(tagName);
    if (current == null) {
      current = target.findOrCreateAnnotation(tagName);
      setPosition(current,tag);
    }
    MAnnotation literal = target.addLiteralAnnotation(tagName);
    setPosition(literal,tag);
    MAnnotation[] out = new MAnnotation[] {literal,current};
    if (mAddSingleValueMembers) setSingleValueText(out,tag);
    return out;
  }
View Full Code Here


  // ========================================================================
  // MAnnotatedElement implementation

  public AnnotationProxy getEditableProxy(Class proxyClass) {
    if (mName2Annotation == null) return null;
    MAnnotation out = getMutableAnnotation(proxyClass.getName());
    return (out == null) ? null : (AnnotationProxy)out.getProxy();
  }
View Full Code Here

    return (MAnnotation)mName2Annotation.get(named);
  }

  public MAnnotation findOrCreateAnnotation(String annotationName) {
    //ClassImpl.validateClassName(annotationName);
    MAnnotation ann = getMutableAnnotation(annotationName);
    if (ann != null) return ann;
    AnnotationProxy proxy = getContext().
      createAnnotationProxy(annotationName);
    ann = new AnnotationImpl(getContext(),proxy,annotationName);
    if (mName2Annotation == null) {
      mName2Annotation = new HashMap();
    }
    mName2Annotation.put(ann.getQualifiedName(),ann);
    return ann;
  }
View Full Code Here

    annName = annName.trim();
    // otherwise, we have to create an 'extra' one.  note this will only
    // happen when processing javadoc tags where more than one tag of a given
    // name appears in a given scope
    AnnotationProxy proxy = getContext().createAnnotationProxy(annName);
    MAnnotation ann = new AnnotationImpl(getContext(),proxy,annName);
    if (mAllAnnotations == null) mAllAnnotations = new ArrayList();
    mAllAnnotations.add(ann);

    // if one doesn't exist yet, then create the first one
    if (getMutableAnnotation(annName) == null) {
View Full Code Here

  public MAnnotation addAnnotationForProxy(Class proxyClass,
                                           AnnotationProxy proxy)
  {
    //ClassImpl.validateClassName(annotationName);
    String annotationName = proxyClass.getName();
    MAnnotation ann = getMutableAnnotation(annotationName);
    if (ann != null) return ann;
    ann = new AnnotationImpl(getContext(),proxy,annotationName);
    if (mName2Annotation == null) {
      mName2Annotation = new HashMap();
    }
    mName2Annotation.put(ann.getQualifiedName(),ann);
    return ann;
  }
View Full Code Here

  {
    while(ANNOTATION.equals(getElementName())) {
      nextElement();
      //REVIEW creating ann for tag is not the right thing to do here.
      //we may need to store more info about exactly what the annotation was
      MAnnotation ann = element.addLiteralAnnotation(assertCurrentString(NAME));
      while(ANNOTATIONVALUE.equals(getElementName())) {
        nextElement();
        String name = assertCurrentString(NAME);
        String type = assertCurrentString(TYPE);
        JClass jclass = mContext.getClassLoader().loadClass(type);
        if (jclass.isArrayType()) {
          Collection list = new ArrayList();
          while(VALUE.equals(getElementName())) {
            String value = assertCurrentString(VALUE);
            list.add(value);
          }
          String[] vals = new String[list.size()];
          list.toArray(vals);
          ann.setSimpleValue(name,vals,jclass);
        } else {
          String value = assertCurrentString(VALUE);
          ann.setSimpleValue(name,value, jclass);
        }
        assertEnd(ANNOTATIONVALUE);
        nextElement();
      }
      assertEnd(ANNOTATION);
View Full Code Here

TOP

Related Classes of org.codehaus.jam.mutable.MAnnotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.