Examples of JAnnotationUse


Examples of com.sun.codemodel.JAnnotationUse

    private void annotate( final JCodeModel cm, final JAnnotationArrayMember a, final List<PrimaryKeyJoinColumn> cols )
    {
        for ( PrimaryKeyJoinColumn jc : cols )
        {
            final JAnnotationUse jca = a.annotate( cm.ref( javax.persistence.PrimaryKeyJoinColumn.class ) );
            if ( jc.getColumnDefinition() != null )
            {
                jca.param( "columnDefinition", jc.getColumnDefinition() );
            }
            if ( jc.getName() != null )
            {
                jca.param( "name", jc.getName() );
            }
            if ( jc.getReferencedColumnName() != null )
            {
                jca.param( "referenceColumnName", jc.getReferencedColumnName() );
            }
        }
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

        if ( !gen.getUniqueConstraint().isEmpty() )
        {
            final JAnnotationArrayMember uclst = a.paramArray( "uniqueConstraints" );
            for ( UniqueConstraint uc : gen.getUniqueConstraint() )
            {
                final JAnnotationUse uca = uclst.annotate( javax.persistence.UniqueConstraint.class );
                final JAnnotationArrayMember colNames = uca.paramArray( "columnNames" );
                for ( String cn : uc.getColumnName() )
                {
                    colNames.param( cn );
                }
            }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

        {
            final JMethod getter = this.getGetter( c, e.getName() );
            getter.annotate( cm.ref( javax.persistence.Embedded.class ) );
            if ( !e.getAttributeOverride().isEmpty() )
            {
                final JAnnotationUse aolst = getter.annotate( cm.ref( javax.persistence.AttributeOverrides.class ) );
                final JAnnotationArrayMember value = aolst.paramArray( "value" );
                for ( AttributeOverride o : e.getAttributeOverride() )
                {
                    final JAnnotationUse ao = value.annotate( cm.ref( javax.persistence.AttributeOverride.class ) );
                    if ( o.getColumn() != null )
                    {
                        final JAnnotationUse ac = ao.param( "column", cm.ref( javax.persistence.Column.class ) );
                        this.annotate( ac, o.getColumn() );
                    }
                    if ( o.getName() != null )
                    {
                        ao.param( "name", o.getName() );
                    }
                }
            }
        }

        if ( a.getEmbeddedId() != null )
        {
            final JMethod getter = this.getGetter( c, a.getEmbeddedId().getName() );
            getter.annotate( cm.ref( javax.persistence.EmbeddedId.class ) );
            if ( !a.getEmbeddedId().getAttributeOverride().isEmpty() )
            {
                final JAnnotationUse aolst = getter.annotate( cm.ref( javax.persistence.AttributeOverrides.class ) );
                final JAnnotationArrayMember value = aolst.paramArray( "value" );
                for ( AttributeOverride o : a.getEmbeddedId().getAttributeOverride() )
                {
                    final JAnnotationUse ao = value.annotate( cm.ref( javax.persistence.AttributeOverride.class ) );
                    if ( o.getColumn() != null )
                    {
                        final JAnnotationUse ac = ao.param( "column", cm.ref( javax.persistence.Column.class ) );
                        this.annotate( ac, o.getColumn() );
                    }
                    if ( o.getName() != null )
                    {
                        ao.param( "name", o.getName() );
                    }
                }
            }
        }

        for ( Id i : a.getId() )
        {
            final JMethod getter = this.getGetter( c, i.getName() );
            getter.annotate( cm.ref( javax.persistence.Id.class ) );
            if ( i.getColumn() != null )
            {
                final JAnnotationUse column = getter.annotate( cm.ref( javax.persistence.Column.class ) );
                this.annotate( column, i.getColumn() );
            }
            if ( i.getGeneratedValue() != null )
            {
                final JAnnotationUse gv = getter.annotate( cm.ref( javax.persistence.GeneratedValue.class ) );
                if ( i.getGeneratedValue().getGenerator() != null )
                {
                    gv.param( "generator", i.getGeneratedValue().getGenerator() );
                }
                if ( i.getGeneratedValue().getStrategy() != null )
                {
                    gv.param( "strategy", javax.persistence.GenerationType.valueOf(
                        i.getGeneratedValue().getStrategy().value() ) );

                }
            }
            if ( i.getSequenceGenerator() != null )
            {
                final JAnnotationUse gen = getter.annotate( cm.ref( javax.persistence.SequenceGenerator.class ) );
                this.annotate( gen, i.getSequenceGenerator() );
            }
            if ( i.getTableGenerator() != null )
            {
                final JAnnotationUse gen = getter.annotate( cm.ref( javax.persistence.TableGenerator.class ) );
                this.annotate( gen, i.getTableGenerator() );
            }
            if ( i.getTemporal() != null )
            {
                final JAnnotationUse temp = getter.annotate( cm.ref( javax.persistence.Temporal.class ) );
                temp.param( "value", javax.persistence.TemporalType.valueOf( i.getTemporal().value() ) );
            }
        }

        for ( ManyToMany m : a.getManyToMany() )
        {
            final JMethod getter = this.getGetter( c, m.getName() );
            final JAnnotationUse m2m = getter.annotate( cm.ref( javax.persistence.ManyToMany.class ) );

            if ( m.getCascade() != null )
            {
                this.annotate( m2m, m.getCascade() );
            }
            if ( m.getFetch() != null )
            {
                m2m.param( "fetch", javax.persistence.FetchType.valueOf( m.getFetch().value() ) );
            }
            if ( m.getJoinTable() != null )
            {
                final JAnnotationUse jt = getter.annotate( cm.ref( javax.persistence.JoinTable.class ) );
                this.annotate( cm, jt, m.getJoinTable() );
            }
            if ( m.getMapKey() != null )
            {
                final JAnnotationUse mk = getter.annotate( cm.ref( javax.persistence.MapKey.class ) );
                mk.param( "name", m.getMapKey().getName() );
            }
            if ( m.getMappedBy() != null )
            {
                m2m.param( "mappedBy", m.getMappedBy() );
            }
            if ( m.getOrderBy() != null )
            {
                final JAnnotationUse ob = getter.annotate( cm.ref( javax.persistence.OrderBy.class ) );
                ob.param( "value", m.getOrderBy() );
            }
            if ( m.getTargetEntity() != null )
            {
                m2m.param( "targetEntity", cm.ref( m.getTargetEntity() ) );
            }
        }

        for ( ManyToOne m : a.getManyToOne() )
        {
            final JMethod getter = this.getGetter( c, m.getName() );
            final JAnnotationUse m2o = getter.annotate( cm.ref( javax.persistence.ManyToOne.class ) );
            if ( m.getCascade() != null )
            {
                this.annotate( m2o, m.getCascade() );
            }
            if ( m.getFetch() != null )
            {
                m2o.param( "fetch", javax.persistence.FetchType.valueOf( m.getFetch().value() ) );
            }
            if ( !m.getJoinColumn().isEmpty() )
            {
                for ( JoinColumn jc : m.getJoinColumn() )
                {
                    final JAnnotationUse jca = getter.annotate( cm.ref( javax.persistence.JoinColumn.class ) );
                    this.annotate( jca, jc );
                }
            }
            if ( m.getJoinTable() != null )
            {
                final JAnnotationUse jt = getter.annotate( cm.ref( javax.persistence.JoinTable.class ) );
                this.annotate( cm, jt, m.getJoinTable() );
            }
            if ( m.getTargetEntity() != null )
            {
                m2o.param( "targetEntity", cm.ref( m.getTargetEntity() ) );
            }
            if ( m.isOptional() != null )
            {
                m2o.param( "optional", m.isOptional().booleanValue() );
            }
        }

        for ( OneToMany m : a.getOneToMany() )
        {
            final JMethod getter = this.getGetter( c, m.getName() );
            final JAnnotationUse o2m = getter.annotate( cm.ref( javax.persistence.OneToMany.class ) );

            if ( m.getCascade() != null )
            {
                this.annotate( o2m, m.getCascade() );
            }
            if ( m.getFetch() != null )
            {
                o2m.param( "fetch", javax.persistence.FetchType.valueOf( m.getFetch().value() ) );
            }
            if ( !m.getJoinColumn().isEmpty() )
            {
                for ( JoinColumn jc : m.getJoinColumn() )
                {
                    final JAnnotationUse jca = getter.annotate( cm.ref( javax.persistence.JoinColumn.class ) );
                    this.annotate( jca, jc );
                }
            }
            if ( m.getJoinTable() != null )
            {
                final JAnnotationUse jt = getter.annotate( cm.ref( javax.persistence.JoinTable.class ) );
                this.annotate( cm, jt, m.getJoinTable() );
            }
            if ( m.getMapKey() != null )
            {
                final JAnnotationUse mk = getter.annotate( cm.ref( javax.persistence.MapKey.class ) );
                mk.param( "name", m.getMapKey().getName() );
            }
            if ( m.getMappedBy() != null )
            {
                o2m.param( "mappedBy", m.getMappedBy() );
            }
            if ( m.getOrderBy() != null )
            {
                final JAnnotationUse ob = getter.annotate( cm.ref( javax.persistence.OrderBy.class ) );
                ob.param( "value", m.getOrderBy() );
            }
            if ( m.getTargetEntity() != null )
            {
                o2m.param( "targetEntity", cm.ref( m.getTargetEntity() ) );
            }
        }

        for ( OneToOne m : a.getOneToOne() )
        {
            final JMethod getter = this.getGetter( c, m.getName() );
            final JAnnotationUse o2o = getter.annotate( cm.ref( javax.persistence.OneToOne.class ) );
            if ( m.getCascade() != null )
            {
                this.annotate( o2o, m.getCascade() );
            }
            if ( m.isOptional() != null )
            {
                o2o.param( "optional", m.isOptional().booleanValue() );
            }
            if ( m.getFetch() != null )
            {
                o2o.param( "fetch", javax.persistence.FetchType.valueOf( m.getFetch().value() ) );
            }
            if ( !m.getJoinColumn().isEmpty() )
            {
                for ( JoinColumn jc : m.getJoinColumn() )
                {
                    final JAnnotationUse jca = getter.annotate( cm.ref( javax.persistence.JoinColumn.class ) );
                    this.annotate( jca, jc );
                }
            }
            if ( m.getJoinTable() != null )
            {
                final JAnnotationUse jt = getter.annotate( cm.ref( javax.persistence.JoinTable.class ) );
                this.annotate( cm, jt, m.getJoinTable() );
            }
            if ( m.getMappedBy() != null )
            {
                o2o.param( "mappedBy", m.getMappedBy() );
            }
            if ( !m.getPrimaryKeyJoinColumn().isEmpty() )
            {
                final JAnnotationUse pkjcs = getter.annotate( cm.ref( javax.persistence.PrimaryKeyJoinColumns.class ) );
                final JAnnotationArrayMember pkjc = pkjcs.paramArray( "value" );
                this.annotate( cm, pkjc, m.getPrimaryKeyJoinColumn() );
            }
            if ( m.getTargetEntity() != null )
            {
                o2o.param( "targetEntity", cm.ref( m.getTargetEntity() ) );
            }
        }

        for ( Transient t : a.getTransient() )
        {
            this.annotate( c, t );
        }

        for ( Version v : a.getVersion() )
        {
            final JMethod getter = this.getGetter( c, v.getName() );
            getter.annotate( cm.ref( javax.persistence.Version.class ) );
            if ( v.getColumn() != null )
            {
                final JAnnotationUse col = getter.annotate( cm.ref( javax.persistence.Column.class ) );
                this.annotate( col, v.getColumn() );
            }
            if ( v.getTemporal() != null )
            {
                final JAnnotationUse temp = getter.annotate( cm.ref( javax.persistence.Temporal.class ) );
                temp.param( "value", javax.persistence.TemporalType.valueOf( v.getTemporal().value() ) );
            }
        }
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

    }

    private void annotate( final ClassOutline c, final Basic b )
    {
        final JMethod getter = this.getGetter( c, b.getName() );
        final JAnnotationUse ann =
            getter.annotate( c.parent().getCodeModel().ref( javax.persistence.Basic.class ) );

        if ( b.isOptional() != null )
        {
            ann.param( "optional", b.isOptional().booleanValue() );
        }
        if ( b.getFetch() != null )
        {
            ann.param( "fetch", javax.persistence.FetchType.valueOf( b.getFetch().value() ) );
        }
        if ( b.getColumn() != null )
        {
            final JAnnotationUse ac = getter.annotate(
                c.parent().getCodeModel().ref( javax.persistence.Column.class ) );
            this.annotate( ac, b.getColumn() );
        }
        if ( b.getEnumerated() != null )
        {
            final JAnnotationUse ac = getter.annotate(
                c.parent().getCodeModel().ref( javax.persistence.Enumerated.class ) );

            ac.param( "value", javax.persistence.EnumType.valueOf( b.getEnumerated().value() ) );
        }
        if ( b.getLob() != null )
        {
            getter.annotate( c.parent().getCodeModel().ref( javax.persistence.Lob.class ) );
        }
        if ( b.getTemporal() != null )
        {
            final JAnnotationUse ta =
                getter.annotate( c.parent().getCodeModel().ref( javax.persistence.Temporal.class ) );

            ta.param( "value", javax.persistence.TemporalType.valueOf( b.getTemporal().value() ) );
        }
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

      //And for stubs also create stubs, otherwise create a "real" object
      JClass fieldType = getJaxbModelType( fieldInfo.getType(), isCollectionType || type == Scope.STUB );
      JFieldVar field = addField( currentClass, fieldType, fieldInfo );

      if ( isCollectionType ) {
        JAnnotationUse annotation = field.annotate( XmlElement.class );
        annotation.param( "name", NamingSupport.createSingular( field.name() ) );
      }

      addGetter( currentClass, fieldType, field, fieldInfo.getSimpleName() );
      addSetter( currentClass, fieldType, field, fieldInfo.getSimpleName() );
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

  @Override
  protected abstract Config getConfig();

  protected void annotate(JDefinedClass cls, String classType, String location)
  {
    JAnnotationUse generatedAnnotation = cls.annotate(Generated.class);
    generatedAnnotation.param("value", getClass().getName());
    String comments = "LinkedIn " + classType;

    if (location != null)
    {
      comments += ". Generated from " + location + '.';
    }

    generatedAnnotation.param("comments", comments);
    generatedAnnotation.param("date", new Date().toString());
  }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

    @Override
    protected void annotate(GenerationContext context, Service service, JDefinedClass jc, Binding binding)
    {
        super.annotate(context, service, jc, binding);
       
        JAnnotationUse ann = jc.annotate(WebService.class);
       
        ann.param("serviceName", service.getSimpleName());
        ann.param("targetNamespace", service.getTargetNamespace());
       
        JClass intf = (JClass) service.getProperty(ServiceInterfaceGenerator.SERVICE_INTERFACE);
        ann.param("endpointInterface", intf.fullName());
       
        jc._implements(intf);

        service.setProperty(SERVICE_STUB, jc);
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

        return ClassType.INTERFACE;
    }

    protected void annotate(GenerationContext context, Service service, JDefinedClass jc, Binding binding)
    {
        JAnnotationUse ann = jc.annotate(WebService.class);
       
        ann.param("name", service.getServiceInfo().getPortType().getLocalPart());
        ann.param("targetNamespace", service.getServiceInfo().getPortType().getNamespaceURI());
       
        service.setProperty(SERVICE_INTERFACE, jc);
       
        AbstractSoapBinding soapBinding = (AbstractSoapBinding) binding;
        ann = jc.annotate(SOAPBinding.class);
        if (soapBinding.getStyle().equals(SoapConstants.STYLE_DOCUMENT))
        {
            ann.param("style", Style.DOCUMENT);
        }
        else if (soapBinding.getStyle().equals(SoapConstants.STYLE_RPC))
        {
            ann.param("style", Style.RPC);
        }
       
        ann.param("use", Use.LITERAL);
       
        if (service.getServiceInfo().isWrapped())
        {
            ann.param("parameterStyle", ParameterStyle.WRAPPED);
        }
        else
        {
           ann.param("parameterStyle", ParameterStyle.BARE);
        }
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

        }
    }

    protected void annotateOutParam(MessagePartInfo part, JVar jvar)
    {
        JAnnotationUse wpann = jvar.annotate(WebParam.class);
        wpann.param("name", part.getName().getLocalPart());
        wpann.param("targetNamespace", part.getName().getNamespaceURI());
        wpann.param("mode", WebParam.Mode.OUT);
    }
View Full Code Here

Examples of com.sun.codemodel.JAnnotationUse

        wpann.param("mode", WebParam.Mode.OUT);
    }
   
    protected void annotateOutParam(MessagePartInfo part, JVar jvar, Binding binding)
    {
        JAnnotationUse wpann = jvar.annotate(WebParam.class);
        wpann.param("name", part.getName().getLocalPart());
        wpann.param("targetNamespace", part.getName().getNamespaceURI());
        wpann.param("mode", WebParam.Mode.OUT);
        wpann.param("header", true);
    }
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.