Package org.codehaus.jam.mutable

Examples of org.codehaus.jam.mutable.MAnnotation


                                  SourcePosition sp)
  {
    if (anns == null) return; //?
    for(int i=0; i<anns.length; i++) {
      String tn = JavadocClassBuilder.getFdFor(anns[i].annotationType());
      MAnnotation destAnn = dest.findOrCreateAnnotation(tn);
      populateAnnotation(destAnn,anns[i],sp);
    }
  }
View Full Code Here


                                   valueObj+", class is "+valueObj.getClass());
    }
    // ok, take a look at how what it really is and translate it into an
    // appropriate represenatation
    if (valueObj instanceof AnnotationDesc) {
      MAnnotation nested = dest.createNestedValue(memberName,typeName);
      populateAnnotation(nested,(AnnotationDesc)valueObj,sp);
    } else if (valueObj instanceof Number || valueObj instanceof Boolean) {
      String tn = JavadocClassBuilder.getFdFor(returnType);
      JClass type = mContext.getClassLoader().loadClass(tn);
      dest.setSimpleValue(memberName,valueObj,type);
View Full Code Here

  private void extractAnnotations(MAnnotatedElement dest,
                                  Annotation[] anns)
  {
    if (anns == null || anns.length == 0) return;
    for(int i=0; i<anns.length; i++) {
      MAnnotation destAnn = dest.findOrCreateAnnotation
        (anns[i].annotationType().getName());
      destAnn.setAnnotationInstance(anns[i]);
      populateAnnotation(destAnn,anns[i]);
    }
    //FIXME also overlay default values once they're working in the JDK
  }
View Full Code Here

        if (isVerbose) mLogger.verbose("value is "+value);
        if (value instanceof Annotation) {
          if (isVerbose) mLogger.verbose("it's nested!!  creating for "+
                                         methods[i].getName()+" and "+
                                         annType.getName());
          MAnnotation nested = dest.createNestedValue(methods[i].getName(),
                                                      annType.getName());
          nested.setAnnotationInstance(value);
          populateAnnotation(nested,(Annotation)value);
        } else if (value instanceof Annotation[]) {
          Annotation[] anns = (Annotation[])value;
          MAnnotation[] nested = dest.createNestedValueArray
            (methods[i].getName(),
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

  // 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

  {
    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.