Examples of JAnnotation


Examples of org.codehaus.jam.JAnnotation

  protected void generateTightMarshal2Body(PrintWriter out) {
    List properties = getProperties();
    for (Iterator iter = properties.iterator(); iter.hasNext();) {
      JProperty property = (JProperty) iter.next();
      JAnnotation annotation = property.getAnnotation("openwire:property");
      JAnnotationValue size = annotation.getValue("size");
      JClass propertyType = property.getType();
      String type = propertyType.getSimpleName();
      String getter = "info." + property.getGetter().getSimpleName() + "()";

      if (type.equals("boolean")) {
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

  protected void generateLooseMarshalBody(PrintWriter out) {
    List properties = getProperties();
    for (Iterator iter = properties.iterator(); iter.hasNext();) {
      JProperty property = (JProperty) iter.next();
      JAnnotation annotation = property.getAnnotation("openwire:property");
      JAnnotationValue size = annotation.getValue("size");
      JClass propertyType = property.getType();
      String type = propertyType.getSimpleName();
      String getter = "info." + property.getGetter().getSimpleName() + "()";

      if (type.equals("boolean")) {
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

  protected void generateLooseUnmarshalBody(PrintWriter out) {
    List properties = getProperties();
    for (Iterator iter = properties.iterator(); iter.hasNext();) {
      JProperty property = (JProperty) iter.next();
      JAnnotation annotation = property.getAnnotation("openwire:property");
      JAnnotationValue size = annotation.getValue("size");
      JClass propertyType = property.getType();
      String propertyTypeName = propertyType.getSimpleName();

      if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
        generateLooseUnmarshalBodyForArrayProperty(out, property, size);
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

                properties.add(p);
            }
        }
        for (Iterator iter = properties.iterator(); iter.hasNext();) {
            JProperty property = (JProperty) iter.next();
            JAnnotation annotation = property.getGetter().getAnnotation("openwire:property");
            JAnnotationValue size = annotation.getValue("size");
            String name = toPropertyCase(property.getSimpleName());
            boolean cached = isCachedProperty(property);

            String type = property.getType().getQualifiedName();
            if (type.equals("boolean")) {
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

  // Public methods

  public void addAnnotationClasses(JClass[] classes) {
    for(int i=0; i<classes.length; i++) {
      if (classes[i].isAnnotationType()) {
        JAnnotation ann = classes[i].getAnnotation(mTiger.getAnnogenInfoClass());
        if (ann == null) {
          warn("Ignoring "+classes[i].getQualifiedName()+
               " because it does not declare an @AnnogenInfo annotation.");
          continue; //REVIEW should this be an error instead?
        }
        JAnnotationValue val = ann.getValue(ANNOGENINFO_ANNOBEAN_CLASSNAME);
        if (val == null) {  //should not happen - it's not an optional value
          warn("Ignoring "+classes[i].getQualifiedName()+
               " because its @AnnogenInfo annotation does specify an "+
               ANNOGENINFO_ANNOBEAN_CLASSNAME);
          continue; //REVIEW should this be an error instead?
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

  /**
   * Returns the first annotation with the given name that is found on
   * this property's getter and/or setters.
   */
  public JAnnotation getAnnotation(String named) {
    JAnnotation out = (mGetter != null) ? mGetter.getAnnotation(named) : null;
    if (out != null) return out;
    return (mSetter != null) ? mSetter.getAnnotation(named) : null;
  }
View Full Code Here

Examples of org.codehaus.jam.JAnnotation

    if (mName2Annotation == null) return null;
    valueId = valueId.trim();

    int delim = valueId.indexOf('@');
    if (delim == -1 || delim == valueId.length()-1) {
      JAnnotation ann = getAnnotation(valueId);
      if (ann == null) return null;
      return ann.getValue(JAnnotation.SINGLE_VALUE_NAME);
    } else {
      JAnnotation ann = getAnnotation(valueId.substring(0,delim));
      if (ann == null) return null;

      return ann.getValue(valueId.substring(delim+1));
    }
  }
View Full Code Here

Examples of org.exolab.javasource.JAnnotation

        //-- create getNameSpacePrefix method
        method = new JMethod("getNameSpacePrefix", SGTypes.STRING,
                             "the namespace prefix to use when marshaling as XML.");

        if (_config.useJava50()) {
            method.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = method.getSourceCode();
        jsc.add("return _nsPrefix;");
        addMethod(method);

        //-- create getNameSpaceURI method
        method = new JMethod("getNameSpaceURI", SGTypes.STRING,
                             "the namespace URI used when marshaling and unmarshaling as XML.");

        if (_config.useJava50()) {
            method.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = method.getSourceCode();
        jsc.add("return _nsURI;");
        addMethod(method);

        //-- create getValidator method
        method = new JMethod("getValidator", TYPE_VALIDATOR_CLASS,
                             "a specific validator for the class described"
                             + " by this ClassDescriptor.");

        if (_config.useJava50()) {
            method.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = method.getSourceCode();
        jsc.add("return this;");
        addMethod(method);

        //-- create getXMLName method
        method = new JMethod("getXMLName", SGTypes.STRING,
                             "the XML Name for the Class being described.");

        if (_config.useJava50()) {
            method.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = method.getSourceCode();
        jsc.add("return _xmlName;");
        addMethod(method);
View Full Code Here

Examples of org.exolab.javasource.JAnnotation

        JClass amClass = new JClass(MAPPING_ACCESS_MODE);
        JMethod getAccessMode = new JMethod("getAccessMode", amClass,
                                     "the access mode specified for this class.");

        if (_config.useJava50()) {
            getAccessMode.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = getAccessMode.getSourceCode();
        jsc.add("return null;");
        addMethod(getAccessMode);

        //-- create getIdentity method
        JMethod getIdentity = new JMethod("getIdentity", FIELD_DESCRIPTOR_CLASS,
                                   "the identity field, null if this class has no identity.");

        if (_config.useJava50()) {
            getIdentity.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = getIdentity.getSourceCode();
        if (extended) {
            jsc.add("if (_identity == null) {");
            jsc.indent();
            jsc.add("return super.getIdentity();");
            jsc.unindent();
            jsc.add("}");
        }
        jsc.add("return _identity;");

        //--don't add the type to the import list
        addMethod(getIdentity, false);

        //-- create getJavaClass method
        JMethod getJavaClass = new JMethod("getJavaClass", SGTypes.CLASS,
                                    "the Java class represented by this descriptor.");

        if (_config.useJava50()) {
            getJavaClass.addAnnotation(new JAnnotation(new JAnnotationType("Override")));
        }

        jsc = getJavaClass.getSourceCode();
        jsc.add("return ");
        jsc.append(classType(_type));
View Full Code Here

Examples of org.exolab.javasource.JAnnotation

    private String printAnnotationValue(final Object elementValue, final String shift) {
        // String?
        if (elementValue instanceof String) {
            return (String) elementValue;
        } else if (elementValue instanceof JAnnotation) {
            JAnnotation annotation = (JAnnotation) elementValue;
            return printAnnotation(annotation, shift);
        } else if (elementValue.getClass().isArray()) {
            // Short hand for single item list
            int listLength = Array.getLength(elementValue);
            if (listLength == 1) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.