Package com.sun.codemodel

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


    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


   
    if (var == null) {
      // fall back to original detection algorithm
      return null;
    }
    return var.type();
  }

  private String replaceAndUpperCase(StringBuffer local) {
    for (int i = 0; i < local.length(); i++) {
      char c = local.charAt(i);
View Full Code Here

            }
          }
        }

        // Transform the field accordingly.
        originalImplField.type(collectionInterfaceClass);

        // If instantiation is specified to be "early", add code for creating new instance of the collection class.
        if (fieldConfiguration.getInstantiationMode() == Configuration.InstantiationMode.EARLY) {
          logger.debug("Applying EARLY instantiation...");
          // GENERATED CODE: ... fieldName = new C<T>();
View Full Code Here

        field = f;
      }

      // "field" is null if there are no fields (or all fields are static) or there are more then two fields.
      // The only property should be a collection, hence it should be class:
      if (field == null || !(field.type() instanceof JClass)) {
        continue;
      }

      JClass fieldType = (JClass) field.type();
View Full Code Here

      // The only property should be a collection, hence it should be class:
      if (field == null || !(field.type() instanceof JClass)) {
        continue;
      }

      JClass fieldType = (JClass) field.type();

      // * The property should be a collection
      if (!collectionModelClass.isAssignableFrom(fieldType)) {
        continue;
      }
View Full Code Here

        AttributeUseImpl attribute = (AttributeUseImpl) attributeProperty.getSchemaComponent();
        XSSimpleType type = attribute.getDecl().getType();

        // Use="required". It makes sense to annotate a required attribute with @NotNull even though it's not 100 % semantically equivalent.
        if (attribute.isRequired() && !fieldVar.type().isPrimitive()) notNullAnnotate(fieldVar);

        processSimpleType(type, fieldVar, customizations);
    }

    /**
 
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.