Examples of narrow()


Examples of com.helger.jcodemodel.AbstractJClass.narrow()

    private AbstractJClass narrowed(AbstractJClass usedDataType, AbstractJClass resultType, AbstractJClass exceptionType, AbstractJClass selfType) {
        Iterator<? extends AbstractJClass> dataTypeArgumentIterator = usedDataType.getTypeParameters().iterator();
        AbstractJClass result = visitorInterfaceModel;
        for (JTypeVar typeVariable: visitorInterfaceModel.typeParams()) {
            if (typeParameters.isSpecial(typeVariable))
                result = result.narrow(typeParameters.substituteSpecialType(typeVariable, usedDataType, resultType, exceptionType));
            else
                result = result.narrow(dataTypeArgumentIterator.next());
        }
        return result;
    }
View Full Code Here

Examples of com.helger.jcodemodel.AbstractJClass.narrow()

        AbstractJClass result = visitorInterfaceModel;
        for (JTypeVar typeVariable: visitorInterfaceModel.typeParams()) {
            if (typeParameters.isSpecial(typeVariable))
                result = result.narrow(typeParameters.substituteSpecialType(typeVariable, usedDataType, resultType, exceptionType));
            else
                result = result.narrow(dataTypeArgumentIterator.next());
        }
        return result;
    }

    public Collection<JMethod> methods() {
View Full Code Here

Examples of com.helger.jcodemodel.AbstractJClass.narrow()

                public AbstractJType visitDeclared(DeclaredType t, Void p) {
                    try {
                        TypeElement element = (TypeElement)t.asElement();
                        AbstractJClass _class = ref(element);
                        for (TypeMirror typeArgument: t.getTypeArguments()) {
                            _class = _class.narrow(toJType(typeArgument, environment));
                        }
                        return _class;
                    } catch (ProcessingException ex) {
                        throw new RuntimeProcessingException(ex);
                    }
View Full Code Here

Examples of com.helger.jcodemodel.JDefinedClass.narrow()

                valueClass._implements(types._Serializable);
                valueClass.field(JMod.PRIVATE | JMod.FINAL | JMod.STATIC, types._long, "serialVersionUID", JExpr.lit(annotation.valueClassSerialVersionUID()));
            }

            if (annotation.valueClassIsComparable()) {
                valueClass._implements(types._Comparable.narrow(valueClass.narrow(valueClass.typeParams())));
            }

            JDefinedClass acceptingInterface = createAcceptingInterface(valueClass, visitorInterface, types);
            if (annotation.valueClassIsSerializable()) {
                acceptingInterface._extends(types._Serializable);
View Full Code Here

Examples of com.helger.jcodemodel.JDefinedClass.narrow()

        JInvocation nullPointerExceptionConstruction = JExpr._new(types._NullPointerException);
        nullPointerExceptionConstruction.arg(JExpr.lit("Argument shouldn't be null: 'implementation' argument in class constructor invocation: " + valueClass.fullName()));
        nullCheck._then()._throw(nullPointerExceptionConstruction);

        JDefinedClass proxyClass = createProxyClass(serialization);
        AbstractJClass usedProxyClassType = proxyClass.narrow(valueClass.typeParams());
        JInvocation construction = JExpr._new(usedProxyClassType);
        construction.arg(JExpr.ref("implementation"));
        constructor.body().assign(JExpr.refthis(acceptorField.name()), construction);
    }
View Full Code Here

Examples of com.helger.jcodemodel.JDefinedClass.narrow()

        methodAnnotationUse.param("value", "unchecked");
        for (JTypeVar visitorTypeParameter: visitorInterface.getValueTypeParameters()) {
            Types.generifyWithBoundsFrom(factoryMethod, visitorTypeParameter.name(), visitorTypeParameter);
        }
        AbstractJClass usedValueClassType = valueClass.narrow(factoryMethod.typeParams());
        AbstractJClass usedFactoryType = factory.narrow(factoryMethod.typeParams());
        factoryMethod.type(visitorInterface.narrowed(usedValueClassType, usedValueClassType, types._RuntimeException));
        IJExpression result = JExpr.ref("FACTORY");
        result = usedFactoryType.getTypeParameters().isEmpty() ? result : JExpr.cast(usedFactoryType, result);
        factoryMethod.body()._return(result);
        return factoryMethod;
View Full Code Here

Examples of com.helger.jcodemodel.JInvocation.narrow()

            JMethod visitorMethod1 = visitor.method(interfaceMethod1.mods().getValue() & ~JMod.ABSTRACT, usedValueClassType, interfaceMethod1.name());
            visitorMethod1.annotate(Override.class);
            visitorMethod1.annotate(Nonnull.class);
            JInvocation invocation = valueClass.staticInvoke(interfaceMethod1.name());
            for (JTypeVar typeArgument: valueClass.typeParams())
                invocation.narrow(typeArgument);
            for (JVar param: interfaceMethod1.params()) {
                AbstractJType argumentType = visitorInterface.substituteSpecialType(param.type(), usedValueClassType, configuration.type().boxify(), types._RuntimeException);
                JVar argument = visitorMethod1.param(param.mods().getValue(), argumentType, nameSource.get(param.name()));
                if (configuration.isFieldValue(interfaceMethod1, param.name())) {
                    invocation.arg(newValue);
View Full Code Here

Examples of com.sun.codemodel.JClass.narrow()

          clazz = clazz2;
//          LOG.info("!333b>>>>>>>" + clazz.fullName());
        }
        if (jFieldVar.fullName().startsWith("java.util.List")) {
          JClass list = cm.ref(List.class);
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + list.narrow(clazz).name() );
          //jFieldVar.type(arrayList.narrow(clazz));
          return list.narrow(clazz);
        } else if (jFieldVar.fullName().startsWith("java.util.Arrayist")) {
          JClass arrayList = cm.ref(ArrayList.class);
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + arrayList.narrow(clazz).name() );
View Full Code Here

Examples of com.sun.codemodel.JClass.narrow()

        }
        if (jFieldVar.fullName().startsWith("java.util.List")) {
          JClass list = cm.ref(List.class);
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + list.narrow(clazz).name() );
          //jFieldVar.type(arrayList.narrow(clazz));
          return list.narrow(clazz);
        } else if (jFieldVar.fullName().startsWith("java.util.Arrayist")) {
          JClass arrayList = cm.ref(ArrayList.class);
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + arrayList.narrow(clazz).name() );
          //jFieldVar.type(arrayList.narrow(clazz));
          return arrayList.narrow(clazz);
View Full Code Here

Examples of com.sun.codemodel.JClass.narrow()

          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + list.narrow(clazz).name() );
          //jFieldVar.type(arrayList.narrow(clazz));
          return list.narrow(clazz);
        } else if (jFieldVar.fullName().startsWith("java.util.Arrayist")) {
          JClass arrayList = cm.ref(ArrayList.class);
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + arrayList.narrow(clazz).name() );
          //jFieldVar.type(arrayList.narrow(clazz));
          return arrayList.narrow(clazz);
        } else {
          LOG.info(">>>>>>> change " + jFieldVar.name() + " -> " + clazz.name());
          //jFieldVar.type(clazz);
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.