Package com.sun.codemodel

Examples of com.sun.codemodel.JType


            name = part.getTypeQName();
        }
        Mapping mapping = model.get(name);
       
        //String clsName = null;
        JType jType = null;
        if (mapping != null) {
           
            jType = mapping.getType().getTypeClass();             
           
        }
       
        if (jType == null) {
            TypeAndAnnotation typeAndAnnotation = model.getJavaType(part.getTypeQName());          
            if (typeAndAnnotation != null) {               
                jType = typeAndAnnotation.getTypeClass();
            }
        }
       
        if (jType == null) {
            throw new ServiceConstructionException(new Message("NO_JAXB_CLASS", LOG, name));
        }
           
        Class cls;
       
        //JClass jclass;
        try {
            if (!jType.isPrimitive()) {
                cls = ClassLoaderUtils.loadClass(jType.fullName(), getClass());
            } else {
                cls = PrimitiveUtils.getClass(jType.fullName());
            }
        } catch (ClassNotFoundException e) {
            throw new ServiceConstructionException(e);
        }
       
View Full Code Here


                    writer.write("();");
                    fillInFields(writer, indent, path, varName, jdc);
                }
            } else {
                boolean found = false;
                JType tp2 = tp.erasure();
                try {
                    Field f = tp2.getClass().getDeclaredField("_class");
                    f.setAccessible(true);
                    Class<?> cls = (Class)f.get(tp2);
                    if (List.class.isAssignableFrom(cls)) {
                        found = true;
View Full Code Here

            if (mapping != null) {
                typeAnno = mapping.getType();
            }
        }
        if (typeAnno != null) {
            final JType type = typeAnno.getTypeClass();
            return new JAXBDefaultValueWriter(type);
        }
        return null;
    }
View Full Code Here

            }
        }
        TypeList r = new TypeList();
        r.add(prop.ref());

        JType t;
        if(prop.baseType!=null)
            t = prop.baseType;
        else
            t = TypeUtil.getCommonBaseType(codeModel,r);

        // if item type is unboxable, convert t=Integer -> t=int
        // the in-memory data structure can't have primitives directly,
        // but this guarantees that items cannot legal hold null,
        // which helps us improve the boundary signature between our
        // data structure and user code
        if(prop.isUnboxable())
            t = t.unboxify();
        return t;
    }
View Full Code Here

     * Returns contents to be added to javadoc.
     */
    protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
        List<Object> r = new ArrayList<Object>();
        for( CTypeInfo tt : prop.ref() ) {
            JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
            if( t.isPrimitive() || t.isArray() )
                r.add(t.fullName());
            else {
                r.add(t);
                r.add("\n");
            }
        }
View Full Code Here

                //no default values for abstract classes
                typeAnno = null;
            }
        }
        if (typeAnno != null) {
            final JType type = typeAnno.getTypeClass();
            return new JAXBDefaultValueWriter(type);
        }
        return null;
    }
View Full Code Here

                List<? extends Property> propList = mapping.getWrapperStyleDrilldown();
                for (Property pro : propList) {
                    if (pro.elementName().getNamespaceURI().equals(item.getNamespaceURI())
                        && pro.elementName().getLocalPart().equals(item.getLocalPart())) {

                        JType type = pro.type();
                        if (type instanceof JDefinedClass
                            && ((JDefinedClass)type).isAbstract()) {
                            //no default values for abstract classes
                            return null;
                        }
View Full Code Here

                    writer.write("();");
                    fillInFields(writer, indent, path, varName, jdc);
                }
            } else {
                boolean found = false;
                JType tp2 = tp.erasure();
                try {
                    Field f = tp2.getClass().getDeclaredField("_class");
                    f.setAccessible(true);
                    Class<?> cls = (Class<?>)f.get(tp2);
                    if (List.class.isAssignableFrom(cls)) {
                        found = true;
View Full Code Here

    this.classRefSupport = classRefSupport;
  }

  @Nonnull
  public JExpression create( @Nonnull JType type, @Nonnull String simpleName ) {
    JType erased = type.erasure();
    if ( TypeUtils.isType( erased, String.class ) ) {
      return JExpr.lit( simpleName );
    }

    //Primitive types
View Full Code Here

                    writer.write("();");
                    fillInFields(writer, indent, path, varName, jdc);
                }
            } else {
                boolean found = false;
                JType tp2 = tp.erasure();
                try {
                    Field f = tp2.getClass().getDeclaredField("_class");
                    f.setAccessible(true);
                    Class<?> cls = (Class<?>)f.get(tp2);
                    if (List.class.isAssignableFrom(cls)) {
                        found = true;
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JType

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.