Package com.sun.codemodel

Examples of com.sun.codemodel.JFieldVar.annotate()


    return testClass;
  }

  protected void createDataPoint( @Nonnull JDefinedClass testClass, @Nonnull JClass serializerClass, @Nonnull JClass domainType, @Nonnull DomainObjectDescriptor domainObjectDescriptor ) {
    JFieldVar field = testClass.field( JMod.STATIC | JMod.PUBLIC | JMod.FINAL, codeGenerator.ref( Entry.class ).narrow( domainType.wildcard() ), DATA_POINT_FIELD_NAME );
    field.annotate( codeModel.ref( "org.junit.experimental.theories.DataPoint" ) );

    JInvocation domainObjectCreation = createDomainObjectCreationExpression( domainObjectDescriptor );
    JExpression expected = createExpectedExpression( testClass, domainType );

    field.init( testClass.staticInvoke( METHOD_NAME_CREATE ).arg( domainObjectCreation ).arg( expected ) );
View Full Code Here


      JFieldVar field = clazz.field(JMod.PRIVATE, type, realVariableName);
     
      if (xmlTransient == false)
      {
         // define XmlElement annotation for variable
         JAnnotationUse annotation = field.annotate(XmlElement.class);
         annotation.param("name", name.getLocalPart());
         if (name.getNamespaceURI() != null)
         {
            annotation.param("namespace", name.getNamespaceURI());
         }
View Full Code Here

         }
      }
      else
      {
         //XmlTransient
         field.annotate(XmlTransient.class);
      }
     
      if (xmlList)
      {
         field.annotate(XmlList.class);
View Full Code Here

         field.annotate(XmlTransient.class);
      }
     
      if (xmlList)
      {
         field.annotate(XmlList.class);
      }
     
      if (adapter != null)
      {
         JAnnotationUse xmlJavaTypeAdapter = field.annotate(XmlJavaTypeAdapter.class);
View Full Code Here

         field.annotate(XmlList.class);
      }
     
      if (adapter != null)
      {
         JAnnotationUse xmlJavaTypeAdapter = field.annotate(XmlJavaTypeAdapter.class);
         xmlJavaTypeAdapter.param("value", codeModel.ref(adapter));
      }

      // generate acessor get method for variable
      JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(javaType) + JavaUtils.capitalize(variable));
View Full Code Here

      JFieldVar field = clazz.field(JMod.PRIVATE, javaType, realVariableName);
     
      if (xmlTransient == false)
      {
         // define XmlElement annotation for variable
         JAnnotationUse annotation = field.annotate(XmlElement.class);
         annotation.param("name", name.getLocalPart());
         if (name.getNamespaceURI() != null)
         {
            annotation.param("namespace", name.getNamespaceURI());
         }
View Full Code Here

         }
      }
      else
      {
         //XmlTransient
         field.annotate(XmlTransient.class);
      }

      // generate acessor get method for variable
      JMethod method = clazz.method(JMod.PUBLIC, javaType, getterPrefix(javaType) + JavaUtils.capitalize(variable));
      method.body()._return(JExpr._this().ref(realVariableName));
View Full Code Here

/*     */   private void addProperty(JDefinedClass clazz, String typeName, QName name, String variable)
/*     */     throws ClassNotFoundException
/*     */   {
/* 135 */     Class type = JavaUtils.loadJavaType(typeName, this.loader);
/* 136 */     JFieldVar field = clazz.field(4, type, variable);
/* 137 */     JAnnotationUse annotation = field.annotate(XmlElement.class);
/* 138 */     if (name.getNamespaceURI() != null)
/* 139 */       annotation.param("namespace", name.getNamespaceURI());
/* 140 */     annotation.param("name", name.getLocalPart());
/*     */
/* 143 */     JMethod method = clazz.method(1, type, getterPrefix(type) + JavaUtils.capitalize(variable));
View Full Code Here

      LOGGER.debug("Processing field: {}, of type: {}", fieldName, fieldType);

      if (isArray) {
        boolean isConstant = field.isStatic() == null ? true : field.isStatic();
        int size = (int) (field.getOccurs() == null ? -1 : field.getOccurs());
        packetField.annotate(PacketArray.class).param("constant", isConstant).param("size", size);
      }

      if (fromClient) { // then only generate getters
        String methodName = "get" + name;
        JMethod getter = packetClass.method(JMod.PUBLIC, fieldType, methodName);
View Full Code Here

      JFieldVar field = clazz.field(JMod.PRIVATE, type, realVariableName);
     
      if (xmlTransient == false)
      {
         // define XmlElement annotation for variable
         JAnnotationUse annotation = field.annotate(XmlElement.class);
         annotation.param("name", name.getLocalPart());
         if (name.getNamespaceURI() != null)
         {
            annotation.param("namespace", name.getNamespaceURI());
         }
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.