Package com.sun.codemodel

Examples of com.sun.codemodel.JMethod.param()


  @Nonnull
  protected JMethod createDeserializeMethodStub( @Nonnull JType domainType, @Nonnull JDefinedClass serializerClass ) {
    JMethod deserializeMethod = serializerClass.method( JMod.PUBLIC, domainType, METHOD_NAME_DESERIALIZE );
    deserializeMethod.param( getSerializeFromType(), METHOD_NAME_DESERIALIZE_FROM );
    JVar formatVersion = deserializeMethod.param( codeGenerator.ref( Version.class ), PARAM_NAME_FORMAT_VERSION );
    deserializeMethod.annotate( Override.class );
    deserializeMethod._throws( IOException.class )._throws( VersionException.class )._throws( ( Class ) getExceptionType() );

    deserializeMethod.body().invoke( "verifyVersionReadable" ).arg( formatVersion );
View Full Code Here


        getter.body()._return( field );

        final JMethod setter = c.implClass.method( JMod.PUBLIC, c.parent().getCodeModel().VOID,
                                                   "set" + String.valueOf( chars ) );

        final JVar valueParam = setter.param( JMod.FINAL, type, "value" );
        setter.body().directStatement( "// " + getMessage( "title" ) );
        setter.body().assign( JExpr._this().ref( field ), valueParam );

        getter.javadoc().append( "Gets the value of the " + name + " property." );
        getter.javadoc().addReturn().append( "The value of the " + name + " property." );
View Full Code Here

    private void generateCollectionSetter( final JCodeModel cm, final ClassOutline c, final CPropertyInfo p )
    {
        final JFieldVar field = c.implClass.fields().get( p.getName( false ) );
        final JMethod setter = c.implClass.method( JMod.PUBLIC, cm.VOID, "set" + p.getName( true ) );
        final JVar valueParam = setter.param( JMod.FINAL, field.type(), "value" );
        final JBlock body = setter.body();
        body.directStatement( "// " + getMessage( "title" ) );
        body.assign( JExpr._this().ref( field ), valueParam );

        setter.javadoc().append( "Sets the value of the " + p.getName( false ) + " property." );
View Full Code Here

        // Setter.
        final JMethod setter = f.parent().implClass.method(
            JMod.PUBLIC, f.parent().parent().getCodeModel().VOID, "setJpa" + f.getPropertyInfo().getName( true ) );

        final JVar calendar = setter.param( JMod.FINAL, Calendar.class, "value" );

        setter.body().directStatement( "// " + getMessage( "title" ) );
        setter.body().assign( JExpr.refthis( field.name() ), calendar );
        setter.body().assign( JExpr.refthis( f.getPropertyInfo().getName( false ) ), f.parent()._package().
            objectFactory().staticInvoke( "createXMLGregorianCalendar" ).arg( calendar ) );
View Full Code Here

    {
        final JDefinedClass of = p.objectFactory();

        // createCalendar
        final JMethod createCalendar = of.method( JMod.STATIC, cm.ref( Calendar.class ), "createCalendar" );
        JVar value = createCalendar.param( JMod.FINAL, XMLGregorianCalendar.class, "value" );
        createCalendar.body().directStatement( "// " + getMessage( "title" ) );
        createCalendar.body()._return(
            JOp.cond( value.eq( JExpr._null() ), JExpr._null(), value.invoke( "toGregorianCalendar" ) ) );

        createCalendar.javadoc().append( "Creates a " + Calendar.class.getName() + " instance from a "
View Full Code Here

        // createXMLGregorianCalendar
        final JMethod createXMLGregorianCalendar =
            of.method( JMod.STATIC, XMLGregorianCalendar.class, "createXMLGregorianCalendar" );

        createXMLGregorianCalendar.body().directStatement( "// " + getMessage( "title" ) );
        value = createXMLGregorianCalendar.param( JMod.FINAL, Calendar.class, "value" );

        final JTryBlock tryBlock = createXMLGregorianCalendar.body()._try();
        final JConditional notNull = tryBlock.body()._if( value.ne( JExpr._null() ) );

        final JVar calendar = notNull._then().decl( cm.ref( GregorianCalendar.class ), "calendar" );
View Full Code Here

        }
    }
   
    protected void writeReadAsType() {
        JMethod m = getReaderClass().method(JMod.PUBLIC, Object.class, "read");
        m.param(XoXMLStreamReader.class, "reader");
        m.param(buildContext.getStringToObjectMap(), "properties");
        JVar typeVar = m.param(QName.class, "type");
        m._throws(XMLStreamException.class);
       
        JBlock block = m.body();
View Full Code Here

    }
   
    protected void writeReadAsType() {
        JMethod m = getReaderClass().method(JMod.PUBLIC, Object.class, "read");
        m.param(XoXMLStreamReader.class, "reader");
        m.param(buildContext.getStringToObjectMap(), "properties");
        JVar typeVar = m.param(QName.class, "type");
        m._throws(XMLStreamException.class);
       
        JBlock block = m.body();
        writeXsiChecks(block, typeVar);
View Full Code Here

   
    protected void writeReadAsType() {
        JMethod m = getReaderClass().method(JMod.PUBLIC, Object.class, "read");
        m.param(XoXMLStreamReader.class, "reader");
        m.param(buildContext.getStringToObjectMap(), "properties");
        JVar typeVar = m.param(QName.class, "type");
        m._throws(XMLStreamException.class);
       
        JBlock block = m.body();
        writeXsiChecks(block, typeVar);
       
View Full Code Here

            JInvocation invocation = JExpr.invoke(nextMethod).arg(xsrVar).arg(rtContextVar);
            for (JVar v : builder.variables) {
                invocation.arg(v);
            }
           
            nextMethod.param(model._ref(String.class), "_attValue");
            invocation.arg(attValue);
           
            nextMethod.body().add(builder.codeBlock);
           
            if (root && builder.returnType != null) {
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.