Package com.sun.codemodel

Examples of com.sun.codemodel.JClass


                        writer.write("();");

                        f = tp.getClass().getDeclaredField("args");
                        f.setAccessible(true);
                        List<JClass> lcl = CastUtils.cast((List<?>)f.get(tp));
                        JClass cl = lcl.get(0);

                        int cnt = defaultValues.getListLength(path + "/" + varName);
                        for (int x = 0; x < cnt; x++) {

                            writer.write("\n");
View Full Code Here


            }
        }
        public void fillInFields(Writer writer, String indent,
                                      String path, String varName,
                                      JDefinedClass tp) throws IOException {
            JClass sp = tp._extends();
            if (sp instanceof JDefinedClass) {
                fillInFields(writer, indent, path, varName, (JDefinedClass)sp);
            }

            Collection<JMethod> methods = tp.methods();
View Full Code Here

                        writer.write("();");
                       
                        f = tp.getClass().getDeclaredField("args");
                        f.setAccessible(true);
                        List<JClass> lcl = CastUtils.cast((List)f.get(tp));
                        JClass cl = lcl.get(0);
                       
                        int cnt = defaultValues.getListLength(path + "/" + varName);
                        for (int x = 0; x < cnt; x++) {

                            writer.write("\n");
View Full Code Here

            }
        }
        public void fillInFields(Writer writer, String indent,
                                      String path, String varName,
                                      JDefinedClass tp) throws IOException {
            JClass sp = tp._extends();
            if (sp instanceof JDefinedClass) {
                fillInFields(writer, indent, path, varName, (JDefinedClass)sp);
            }
           
            Collection<JMethod> methods = tp.methods();
View Full Code Here

  }

  @Override
  @NotNull
  public Expressions createReadFromDeserializeFromExpression( @NotNull AbstractGenerator<?> generator, @NotNull JDefinedClass serializerClass, @NotNull JExpression deserializeFrom, @NotNull JVar formatVersion, @NotNull FieldDeclarationInfo fieldInfo ) {
    JClass collectionParamType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() );

    JInvocation nextTagExpression = createNextTagInvocation( serializerClass, deserializeFrom, fieldInfo );

    JInvocation expression = JExpr.invoke( METHOD_NAME_DESERIALIZE_COLLECTION ).arg( deserializeFrom ).arg( JExpr.dotclass( collectionParamType ) ).arg( formatVersion );
    return new Expressions( expression, nextTagExpression );
View Full Code Here

  }

  @NotNull
  @Override
  public JClass generateFieldType( @NotNull FieldDeclarationInfo fieldInfo ) {
    JClass collectionType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() );
    JClass list = codeGenerator.getModel().ref( List.class );
    return list.narrow( collectionType.wildcard() );
  }
View Full Code Here

  @NotNull
  @Override
  public Expressions createReadFromDeserializeFromExpression( @NotNull AbstractGenerator<?> generator, @NotNull JDefinedClass serializerClass, @NotNull JExpression deserializeFrom, @NotNull JVar formatVersion, @NotNull FieldDeclarationInfo fieldInfo ) {
    JInvocation nextTagExpression = createNextTagInvocation( serializerClass, deserializeFrom, fieldInfo );

    JClass type = codeGenerator.ref( fieldInfo.getType().toString() );
    JInvocation expression = JExpr.invoke( METHOD_NAME_DESERIALIZE ).arg( JExpr.dotclass( type ) ).arg( formatVersion ).arg( deserializeFrom );
    return new Expressions( expression, nextTagExpression );
  }
View Full Code Here

        JBlock block = currentBlock._if(objectVar.ne(JExpr._null()))._then();
       
        if (cls.equals(String.class)) {
            writeAs(block, objectVar);
        } else if (cls.equals(int.class) || cls.equals(Integer.class)) {
            JClass jc = (JClass) model._ref(Integer.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(boolean.class) || cls.equals(Boolean.class)) {
            JClass jc = (JClass) model._ref(Boolean.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(short.class) || cls.equals(Short.class)) {
            JClass jc = (JClass) model._ref(Short.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(double.class) || cls.equals(Double.class)) {
            JClass jc = (JClass) model._ref(Double.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(long.class) || cls.equals(Long.class)) {
            JClass jc = (JClass) model._ref(Long.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(float.class) || cls.equals(Float.class)) {
            JClass jc = (JClass) model._ref(Float.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else if (cls.equals(byte.class) || cls.equals(Byte.class)) {
            JClass jc = (JClass) model._ref(Byte.class);
            writeAs(block, jc.staticInvoke("toString").arg(objectVar));
        } else {
            throw new UnsupportedOperationException();
        }
    }
View Full Code Here

        NClass dh = rp.getDOMHandler();
        if(dh!=null) {
            XmlAnyElementWriter xaew = field.annotate2(XmlAnyElementWriter.class);
            xaew.lax(rp.getWildcard().allowTypedObject);

            final JClass value = dh.toType(outline.parent(),IMPLEMENTATION);
            if(!value.equals(codeModel.ref(W3CDomHandler.class))) {
                xaew.value(value);
            }
        }

    }
View Full Code Here

                        writer.write("();");

                        f = tp.getClass().getDeclaredField("args");
                        f.setAccessible(true);
                        List<JClass> lcl = CastUtils.cast((List<?>)f.get(tp));
                        JClass cl = lcl.get(0);

                        int cnt = defaultValues.getListLength(path + "/" + varName);
                        for (int x = 0; x < cnt; x++) {

                            writer.write("\n");
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JClass

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.