Package com.sun.codemodel

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


    private JFieldVar addAdditionalPropertiesField(JDefinedClass jclass, JType propertyType) {
        JClass propertiesMapType = jclass.owner().ref(Map.class);
        propertiesMapType = propertiesMapType.narrow(jclass.owner().ref(String.class), propertyType.boxify());

        JClass propertiesMapImplType = jclass.owner().ref(HashMap.class);
        propertiesMapImplType = propertiesMapImplType.narrow(jclass.owner().ref(String.class), propertyType.boxify());

        JFieldVar field = jclass.field(JMod.PRIVATE, propertiesMapType, "additionalProperties");
       
        ruleFactory.getAnnotator().additionalPropertiesField(field, jclass, "additionalProperties");
       
View Full Code Here


                    }
                } else {
                    types.add(getGenericType(actual));
                }
            }
            raw = raw.narrow(types);

            return raw;
        }
        throw new IllegalStateException();
    }
View Full Code Here

  @Nonnull
  @Override
  public JClass generateFieldType( @Nonnull FieldDeclarationInfo fieldInfo ) {
    JClass collectionType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() );
    JClass list = codeGenerator.getModel().ref( List.class );
    return list.narrow( collectionType.wildcard() );
  }

  @Override
  public boolean canHandle( @Nonnull FieldDeclarationInfo fieldInfo ) {
    return fieldInfo.isCollectionType();
View Full Code Here

      } else {
        collectionParam = ref( collectionParamType.toString() );
      }

      JClass collection = ref( TypeUtils.getErasure( type ) );
      return collection.narrow( collectionParam );
    }

    return ref( TypeUtils.getErasure( type ).toString() );
  }
View Full Code Here

      JClass referencedCollection = ref( TypeUtils.getErasure( type ).toString() );
      if ( referencedCollectionParam == null ) {
        return referencedCollection;
      } else {
        return referencedCollection.narrow( referencedCollectionParam );
      }
    }

    return ref( TypeUtils.getErasure( type ).toString() );
  }
View Full Code Here

         LinkedList<JClass> jclasses = new LinkedList<JClass>();
         for (String tp : typeArguments)
         {
            jclasses.add(codeModel.ref(tp));
         }
         type = type.narrow(jclasses);
      }
      JFieldVar field = clazz.field(JMod.PRIVATE, type, realVariableName);
     
      if (xmlTransient == false)
      {
View Full Code Here

      } else {
        collectionParam = ref( collectionParamType.toString() );
      }

      JClass collection = ref( TypeUtils.getErasure( type ) );
      return collection.narrow( collectionParam );
    }

    return ref( TypeUtils.getErasure( type ).toString() );
  }
View Full Code Here

  @NotNull
  @Override
  public JClass generateFieldType( @NotNull FieldDeclarationInfo fieldInfo ) {
    JClass collectionType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() );
    JClass list = codeGenerator.getModel().ref( List.class );
    return list.narrow( collectionType.wildcard() );
  }

  @Override
  public boolean canHandle( @NotNull FieldDeclarationInfo fieldInfo ) {
    return fieldInfo.isCollectionType();
View Full Code Here

      JClass referencedCollection = ref( TypeUtils.getErasure( type ).toString() );
      if ( referencedCollectionParam == null ) {
        return referencedCollection;
      } else {
        return referencedCollection.narrow( referencedCollectionParam );
      }
    }

    return ref( TypeUtils.getErasure( type ).toString() );
  }
View Full Code Here

      } else {
        collectionParam = ref( collectionParamType.toString() );
      }

      JClass collection = ref( TypeUtils.getErasure( type ) );
      return collection.narrow( collectionParam );
    }

    return ref( TypeUtils.getErasure( type ).toString() );
  }
}
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.