Package org.codehaus.jam

Examples of org.codehaus.jam.JAnnotationValue


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


        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?
        }
        mDeclaredJclass2beanClassname.put(classes[i],val.asString());
        mClassesLeftTodo.add(classes[i]);
      } else {
        warn("Ignoring "+classes[i].getQualifiedName()+
             " because it is not an annotation type.");
      }
View Full Code Here

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

           type = property.getType().getQualifiedName();
           if( type.equals("boolean")) {
out.println("   ow_bit_buffer_append(buffer, object->"+propname+");");
                   } else if( type.equals("byte")) {
                   } else if( type.equals("char")) {
                   } else if( type.equals("short")) {
                   } else if( type.equals("int")) {
                   } else if( type.equals("long")) {
out.println("   ow_marshal1_long(buffer, object->"+propname+");");
                   } else if( type.equals("byte[]")) {
                     if( size ==null ) {
out.println("   ow_bit_buffer_append(buffer,  object->"+propname+"!=0 );");
                     }
                   } else if( type.equals("org.apache.activeio.packet.ByteSequence")) {
                     if( size ==null ) {
out.println("   ow_bit_buffer_append(buffer,  object->"+propname+"!=0 );");
                     }
                   } else if( type.equals("java.lang.String")) {
out.println("   ow_marshal1_string(buffer, object->"+propname+");");
                   } else {
                         if( property.getType().isArrayType() ) {
                           if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_marshal1_DataStructure_array_const_size(buffer, object->"+propname+", "+size.asInt()+"));");
                           } else {
out.println("   SUCCESS_CHECK(ow_marshal1_DataStructure_array(buffer, object->"+propname+"));");
                           }
                         } else if( isThrowable(property.getType()) ) {         
out.println("   SUCCESS_CHECK(ow_marshal1_throwable(buffer, object->"+propname+"));");
                         } else {
                           if( cached ) {
out.println("   SUCCESS_CHECK(ow_marshal1_cached_object(buffer, (ow_DataStructure*)object->"+propname+"));");
                           } else {
out.println("   SUCCESS_CHECK(ow_marshal1_nested_object(buffer, (ow_DataStructure*)object->"+propname+"));");
                           }
                       }
                   }
out.println("");
               }


out.println("   ");
out.println("  return APR_SUCCESS;");
out.println("}");
out.println("apr_status_t ow_marshal2_"+name+"(ow_byte_buffer *buffer, ow_bit_buffer *bitbuffer, ow_"+name+" *object)");
out.println("{");
out.println("   ow_marshal2_"+baseName+"(buffer, bitbuffer, (ow_"+baseName+"*)object);   ");

      for (Iterator iter = properties.iterator(); iter.hasNext();) {
        JProperty property = (JProperty) iter.next();
                   JAnnotation annotation = property.getGetter().getAnnotation("openwire:property");
                   JAnnotationValue size = annotation.getValue("size");
                   Object propname = toPropertyCase(property.getSimpleName());
                   boolean cached = isCachedProperty(property);
                  
                   type = property.getType().getQualifiedName();
                   if( type.equals("boolean") ) {
out.println("   ow_bit_buffer_read(bitbuffer);");
                   } else if( type.equals("byte") ) {
out.println("   SUCCESS_CHECK(ow_byte_buffer_append_"+type+"(buffer, object->"+propname+"));");
                   } else if( type.equals("char") ) {
out.println("   SUCCESS_CHECK(ow_byte_buffer_append_"+type+"(buffer, object->"+propname+"));");
                   } else if( type.equals("short") ) {
out.println("   SUCCESS_CHECK(ow_byte_buffer_append_"+type+"(buffer, object->"+propname+"));");
                   } else if( type.equals("int") ) {
out.println("   SUCCESS_CHECK(ow_byte_buffer_append_"+type+"(buffer, object->"+propname+"));");
                   } else if( type.equals("long") ) {
out.println("   SUCCESS_CHECK(ow_marshal2_long(buffer, bitbuffer, object->"+propname+"));");
                   } else if( type.equals("byte[]") ) {
                       if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_marshal2_byte_array_const_size(buffer, object->"+propname+", "+size.asInt()+"));");
                       } else {
out.println("   SUCCESS_CHECK(ow_marshal2_byte_array(buffer, bitbuffer, object->"+propname+"));");
                       }
                   } else if( type.equals("org.apache.activeio.packet.ByteSequence") ) {
                       if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_marshal2_byte_array_const_size(buffer, object->"+propname+", "+size.asInt()+"));");
                       } else {
out.println("   SUCCESS_CHECK(ow_marshal2_byte_array(buffer, bitbuffer, object->"+propname+"));");
                       }
                   } else if( type.equals("java.lang.String") ) {
out.println("   SUCCESS_CHECK(ow_marshal2_string(buffer, bitbuffer, object->"+propname+"));");
                   } else {
                      if( property.getType().isArrayType() ) {
                         if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_marshal2_DataStructure_array_const_size(buffer, bitbuffer, object->"+propname+", "+size.asInt()+"));");
                         } else {
out.println("   SUCCESS_CHECK(ow_marshal2_DataStructure_array(buffer, bitbuffer, object->"+propname+"));");
                         }
                      } else if( isThrowable(property.getType()) ) {         
out.println("   SUCCESS_CHECK(ow_marshal2_throwable(buffer, bitbuffer, object->"+propname+"));");
                      } else {
                           if( cached ) {
out.println("   SUCCESS_CHECK(ow_marshal2_cached_object(buffer, bitbuffer, (ow_DataStructure*)object->"+propname+"));");
                           } else {
out.println("   SUCCESS_CHECK(ow_marshal2_nested_object(buffer, bitbuffer, (ow_DataStructure*)object->"+propname+"));");
                           }                     
                      }
                   }
out.println("");
               }

out.println("   ");
out.println("  return APR_SUCCESS;");
out.println("}");
out.println("");
out.println("apr_status_t ow_unmarshal_"+name+"(ow_byte_array *buffer, ow_bit_buffer *bitbuffer, ow_"+name+" *object, apr_pool_t *pool)");
out.println("{");
out.println("   ow_unmarshal_"+baseName+"(buffer, bitbuffer, (ow_"+baseName+"*)object, pool);   ");

  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 propname = toPropertyCase(property.getSimpleName());
                   boolean cached = isCachedProperty(property);
                  
                   type = property.getType().getQualifiedName();

                   if( type.equals("boolean") ) {
out.println("   object->"+propname+" = ow_bit_buffer_read(bitbuffer);");
                   } else if( type.equals("byte") ) {
out.println("   SUCCESS_CHECK(ow_byte_array_read_"+type+"(buffer, &object->"+propname+"));");
                   } else if( type.equals("char") ) {
out.println("   SUCCESS_CHECK(ow_byte_array_read_"+type+"(buffer, &object->"+propname+"));");
                   } else if( type.equals("short") ) {
out.println("   SUCCESS_CHECK(ow_byte_array_read_"+type+"(buffer, &object->"+propname+"));");
                   } else if( type.equals("int") ) {
out.println("   SUCCESS_CHECK(ow_byte_array_read_"+type+"(buffer, &object->"+propname+"));");
                   } else if( type.equals("long") ) {
out.println("   SUCCESS_CHECK(ow_unmarshal_long(buffer, bitbuffer, &object->"+propname+", pool));");
                   } else if( type.equals("byte[]") ) {
                       if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_unmarshal_byte_array_const_size(buffer, &object->"+propname+", "+size.asInt()+", pool));");
                       } else {
out.println("   SUCCESS_CHECK(ow_unmarshal_byte_array(buffer, bitbuffer, &object->"+propname+", pool));");
                       }
                   } else if( type.equals("org.apache.activeio.packet.ByteSequence") ) {
                       if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_unmarshal_byte_array_const_size(buffer, &object->"+propname+", "+size.asInt()+", pool));");
                       } else {
out.println("   SUCCESS_CHECK(ow_unmarshal_byte_array(buffer, bitbuffer, &object->"+propname+", pool));");
                       }
                   } else if( type.equals("java.lang.String") ) {
out.println("   SUCCESS_CHECK(ow_unmarshal_string(buffer, bitbuffer, &object->"+propname+", pool));");
                   } else {
                      if( property.getType().isArrayType() ) {
                        if( size!=null ) {
out.println("   SUCCESS_CHECK(ow_unmarshal_DataStructure_array_const_size(buffer, bitbuffer, &object->"+propname+", "+size.asInt()+", pool));");
                        } else {
out.println("   SUCCESS_CHECK(ow_unmarshal_DataStructure_array(buffer, bitbuffer, &object->"+propname+", pool));");
                        }
                      } else if( isThrowable(property.getType()) ) {         
out.println("   SUCCESS_CHECK(ow_unmarshal_throwable(buffer, bitbuffer, &object->"+propname+", pool));");
View Full Code Here

        List properties = getProperties();
        int baseSize = 0;
        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.getSimpleName();

            if (type.equals("boolean")) {
                out.println("        bs.WriteBoolean(" + getter + ");");
            }
            else if (type.equals("byte")) {
                baseSize += 1;
            }
            else if (type.equals("char")) {
                baseSize += 2;
            }
            else if (type.equals("short")) {
                baseSize += 2;
            }
            else if (type.equals("int")) {
                baseSize += 4;
            }
            else if (type.equals("long")) {
                out.println("        rc += TightMarshalLong1(wireFormat, " + getter + ", bs);");
            }
            else if (type.equals("String")) {
                out.print("");
                out.println("        rc += TightMarshalString1(" + getter + ", bs);");
            }
            else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size == null) {
                    out.println("        bs.WriteBoolean(" + getter + "!=null);");
                    out.println("        rc += " + getter + "==null ? 0 : " + getter + ".Length+4;");
                }
                else {
                    baseSize += size.asInt();
                }
            }
            else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        rc += TightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
                }
                else {
                    out.println("        rc += TightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
                }
            }
View Full Code Here

    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.getSimpleName();

            if (type.equals("boolean")) {
                out.println("        bs.ReadBoolean();");
            }
            else if (type.equals("byte")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("char")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("short")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("int")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("long")) {
                out.println("        TightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
            }
            else if (type.equals("String")) {
                out.println("        TightMarshalString2(" + getter + ", dataOut, bs);");
            }
            else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size != null) {
                    out.println("        dataOut.Write(" + getter + ", 0, " + size.asInt() + ");");
                }
                else {
                    out.println("        if(bs.ReadBoolean()) {");
                    out.println("           dataOut.Write(" + getter + ".Length);");
                    out.println("           dataOut.Write(" + getter + ");");
                    out.println("        }");
                }
            }
            else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        TightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
                }
                else {
                    out.println("        TightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
                }
            }
View Full Code Here

    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.getSimpleName();

            if (type.equals("boolean")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("byte")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("char")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("short")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("int")) {
                out.println("        dataOut.Write(" + getter + ");");
            }
            else if (type.equals("long")) {
                out.println("        LooseMarshalLong(wireFormat, " + getter + ", dataOut);");
            }
            else if (type.equals("String")) {
                out.println("        LooseMarshalString(" + getter + ", dataOut);");
            }
            else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size != null) {
                    out.println("        dataOut.Write(" + getter + ", 0, " + size.asInt() + ");");
                }
                else {
                    out.println("        dataOut.Write(" + getter + "!=null);");
                    out.println("        if(" + getter + "!=null) {");
                    out.println("           dataOut.Write(" + getter + ".Length);");
                    out.println("           dataOut.Write(" + getter + ");");
                    out.println("        }");
                }
            }
            else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        LooseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
                }
                else {
                    out.println("        LooseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
                }
            }
View Full Code Here

        List properties = getProperties();
        int baseSize = 0;
        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")) {
                out.println("        bs->writeBoolean( " + getter + " );");
            }
            else if (type.equals("byte")) {
                baseSize += 1;
            }
            else if (type.equals("char")) {
                baseSize += 2;
            }
            else if (type.equals("short")) {
                baseSize += 2;
            }
            else if (type.equals("int")) {
                baseSize += 4;
            }
            else if (type.equals("long")) {
                out.println("        rc += tightMarshalLong1( wireFormat, " + getter + ", bs );");
            }
            else if (type.equals("String")) {
                out.print("");
                out.println("        rc += tightMarshalString1( " + getter + ", bs );" );
            }
            else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size == null) {
                    out.println("        bs->writeBoolean( " + getter + ".size() != 0 );" );
                    out.println("        rc += " + getter + ".size() == 0 ? 0 : (int)" + getter + ".size() + 4;");
                }
                else {
                    baseSize += size.asInt();
                }
            }
            else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        rc += tightMarshalObjectArrayConstSize1( wireFormat, " + getter + ", bs, " + size.asInt() + " );");
                }
                else {
                    out.println("        rc += tightMarshalObjectArray1( wireFormat, " + getter + ", bs );");
                }
            }
View Full Code Here

        List properties = getProperties();
        int count = 0;
        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() + "()";
            count++;

            if (type.equals("boolean")) {
                out.println("        bs->readBoolean();");
            }
            else if (type.equals("byte")) {
                out.println("        dataOut->write( " + getter + " );");
            }
            else if (type.equals("char")) {
                out.println("        dataOut->write( " + getter + " );");
            }
            else if (type.equals("short")) {
                out.println("        dataOut->writeShort( " + getter + " );");
            }
            else if (type.equals("int")) {
                out.println("        dataOut->writeInt( " + getter + " );");
            }
            else if (type.equals("long")) {
                out.println("        tightMarshalLong2( wireFormat, " + getter + ", dataOut, bs );");
            }
            else if (type.equals("String")) {
                out.println("        tightMarshalString2( " + getter + ", dataOut, bs );");
            }
            else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size != null) {
                    out.println("        dataOut->write( (const unsigned char*)(&" + getter + "[0]), " + size.asInt() + " );");
                }
                else {
                    out.println("        if( bs->readBoolean() ) {");
                    out.println("            dataOut->writeInt( (int)" + getter + ".size() );");
                    out.println("            dataOut->write( (const unsigned char*)(&" + getter + "[0]), (int)" + getter + ".size() );");
                    out.println("        }");
                }
            }
            else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        tightMarshalObjectArrayConstSize2( wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + " );");
                }
                else {
                    out.println("        tightMarshalObjectArray2( wireFormat, " + getter + ", dataOut, bs );");
                }
            }
View Full Code Here

    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" ) ) {
                out.println("        dataOut->writeBoolean( " + getter + " );");
            }
            else if( type.equals("byte") ) {
                out.println("        dataOut->write( " + getter + " );");
            }
            else if( type.equals("char") ) {
                out.println("        dataOut->write( " + getter + " );");
            }
            else if( type.equals("short") ) {
                out.println("        dataOut->writeShort( " + getter + " );");
            }
            else if( type.equals("int")) {
                out.println("        dataOut->writeInt( " + getter + " );");
            }
            else if( type.equals("long") ) {
                out.println("        looseMarshalLong( wireFormat, " + getter + ", dataOut );");
            }
            else if( type.equals("String") ) {
                out.println("        looseMarshalString( " + getter + ", dataOut );");
            }
            else if( type.equals("byte[]") || type.equals("ByteSequence") ) {
                if(size != null) {
                    out.println("        dataOut->write( (const unsigned char*)(&" + getter + "[0]), (int)" + size.asInt() + " );");
                }
                else {
                    out.println("        dataOut->write( " + getter + ".size() != 0 );");
                    out.println("        if( " + getter + ".size() != 0 ) {");
                    out.println("            dataOut->writeInt( (int)" + getter + ".size() );");
                    out.println("            dataOut->write( (const unsigned char*)(&" + getter + "[0]), (int)" + getter + ".size() );");
                    out.println("        }");
                }
            }
            else if( propertyType.isArrayType() ) {
                if (size != null) {
                    out.println("        looseMarshalObjectArrayConstSize( wireFormat, " + getter + ", dataOut, " + size.asInt() + " );");
                }
                else {
                    out.println("        looseMarshalObjectArray( wireFormat, " + getter + ", dataOut );");
                }
            }
View Full Code Here

        List properties = getProperties();
        int baseSize = 0;
        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.getSimpleName();

            if (type.equals("boolean")) {
                out.println("        bs.WriteBoolean(" + getter + ");");
            } else if (type.equals("byte")) {
                baseSize += 1;
            } else if (type.equals("char")) {
                baseSize += 2;
            } else if (type.equals("short")) {
                baseSize += 2;
            } else if (type.equals("int")) {
                baseSize += 4;
            } else if (type.equals("long")) {
                out.println("        rc += TightMarshalLong1(wireFormat, " + getter + ", bs);");
            } else if (type.equals("String")) {
                out.print("");
                out.println("        rc += TightMarshalString1(" + getter + ", bs);");
            } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                if (size == null) {
                    out.println("        bs.WriteBoolean(" + getter + "!=null);");
                    out.println("        rc += " + getter + "==null ? 0 : " + getter + ".Length+4;");
                } else {
                    baseSize += size.asInt();
                }
            } else if (propertyType.isArrayType()) {
                if (size != null) {
                    out.println("        rc += TightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
                } else {
                    out.println("        rc += TightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
                }
            } else if (isThrowable(propertyType)) {
                out.println("        rc += TightMarshalBrokerError1(wireFormat, " + getter + ", bs);");
View Full Code Here

TOP

Related Classes of org.codehaus.jam.JAnnotationValue

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.