当前位置: 首页>>代码示例>>Java>>正文


Java DataType类代码示例

本文整理汇总了Java中org.springframework.roo.model.DataType的典型用法代码示例。如果您正苦于以下问题:Java DataType类的具体用法?Java DataType怎么用?Java DataType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataType类属于org.springframework.roo.model包,在下文中一共展示了DataType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListInner_field

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Generates field (list) metadata for ListInner class using
 * <code>name</code> as field name
 * 
 * @param name to use to
 * @param listType list item type
 * @return
 */
private FieldMetadataBuilder getListInner_field(String name,
        JavaType listType) {
    List<JavaType> typeParams = new ArrayList<JavaType>();
    typeParams.add(listType);
    JavaType fieldType = new JavaType("java.util.List", 0, DataType.TYPE,
            null, typeParams);

    FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(getId(),
            Modifier.PROTECTED, new JavaSymbolName(name), fieldType,
            MessageFormat.format("new java.util.ArrayList<{0}>()",
                    new Object[] { listType.getSimpleTypeName() }));

    if (name.equals("list")) {
        // Annotate List field with javax.validation.Valid
        List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(
                1);
        AnnotationMetadataBuilder validAnnotationBuilder = new AnnotationMetadataBuilder(
                new JavaType("javax.validation.Valid"));
        annotations.add(validAnnotationBuilder);
        fieldBuilder.setAnnotations(annotations);
    }

    return fieldBuilder;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:EntityBatchMetadata.java

示例2: getInnerType

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private ClassOrInterfaceTypeDetails getInnerType() {
    final List<FieldMetadataBuilder> fields = new ArrayList<FieldMetadataBuilder>();

    builder.getImportRegistrationResolver().addImports(OP4J_GET,
            JAVA_RUN_TYPE_TYPES);

    final String targetName = super.destination.getSimpleTypeName();
    final String initializer = "Get.attrOf(Types.forClass(" + targetName
            + ".class),\"" + targetName.toLowerCase() + "\")";
    final List<JavaType> parameters = Arrays.asList(OBJECT, destination);
    final JavaType function = new JavaType("org.op4j.functions.Function",
            0, DataType.TYPE, null, parameters);
    final int fieldModifier = Modifier.PUBLIC | Modifier.STATIC
            | Modifier.FINAL;
    final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
            getId(), fieldModifier, new JavaSymbolName(
                    targetName.toUpperCase()), function, initializer);
    fields.add(fieldBuilder);

    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            getId(), Modifier.PUBLIC | Modifier.STATIC, KEYS,
            PhysicalTypeCategory.CLASS);
    cidBuilder.setDeclaredFields(fields);
    return cidBuilder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:26,代码来源:Op4jMetadata.java

示例3: RepositoryMongoMetadata

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Constructor
 * 
 * @param identifier the identifier for this item of metadata (required)
 * @param aspectName the Java type of the ITD (required)
 * @param governorPhysicalTypeMetadata the governor, which is expected to
 *            contain a {@link ClassOrInterfaceTypeDetails} (required)
 * @param annotationValues (required)
 * @param identifierType the type of the entity's identifier field
 *            (required)
 */
public RepositoryMongoMetadata(final String identifier,
        final JavaType aspectName,
        final PhysicalTypeMetadata governorPhysicalTypeMetadata,
        final RepositoryMongoAnnotationValues annotationValues,
        final JavaType identifierType) {
    super(identifier, aspectName, governorPhysicalTypeMetadata);
    Validate.notNull(annotationValues, "Annotation values required");
    Validate.notNull(identifierType, "Identifier type required");

    // Make the user's Repository interface extend Spring Data's Repository
    // interface if it doesn't already
    ensureGovernorExtends(new JavaType(SPRING_DATA_REPOSITORY, 0,
            DataType.TYPE, null, Arrays.asList(
                    annotationValues.getDomainType(), identifierType)));

    builder.addAnnotation(getTypeAnnotation(SpringJavaType.REPOSITORY));

    // Build the ITD
    itdTypeDetails = builder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:32,代码来源:RepositoryMongoMetadata.java

示例4: initializeEntityDependenDefinitions

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Initialize all entity name dependent methods-names and javaTypes
 */
private void initializeEntityDependenDefinitions() {
    this.findAllMethodName = new JavaSymbolName(
            "findAll".concat(StringUtils.capitalize(this.entityPlural)));
    this.findMethodName = new JavaSymbolName("find".concat(StringUtils
            .capitalize(entityName)));
    this.getRevisionsMethodName = new JavaSymbolName("get".concat(
            StringUtils.capitalize(entityName)).concat("Revisions"));
    this.findRevisionsByDatesMethodName = new JavaSymbolName(
            "find".concat(StringUtils.capitalize(entityName).concat(
                    "RevisionsByDates")));
    this.findRevisionsMethodName = new JavaSymbolName(
            "find".concat(StringUtils.capitalize(entityName).concat(
                    "Revisions")));
    this.revisonItemTypeName = StringUtils.capitalize(entityName).concat(
            "Revision");
    this.revisonItemType = new JavaType(entity.getFullyQualifiedTypeName()
            .concat(".").concat(revisonItemTypeName));
    this.revisonItemListType = new JavaType(
            LIST.getFullyQualifiedTypeName(), 0, DataType.TYPE, null,
            Arrays.asList(revisonItemType));
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:JpaAuditMetadata.java

示例5: getMethodParamTypes

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Returns the list of method parameter types.
 * 
 * @param addParamsParameter if true will define
 *        <code>HashMap&lt;String, Object&gt; params</code> parameter
 * @return
 */
private List<AnnotatedJavaType> getMethodParamTypes(
        boolean addParamsParameter) {
    List<AnnotatedJavaType> paramTypes = new ArrayList<AnnotatedJavaType>();

    JavaType dialogType = getJavaTypeForClassName("DialogType");
    paramTypes.add(new AnnotatedJavaType(dialogType,
            new ArrayList<AnnotationMetadata>()));
    paramTypes.add(new AnnotatedJavaType(JavaType.STRING,
            new ArrayList<AnnotationMetadata>()));
    paramTypes.add(new AnnotatedJavaType(JavaType.STRING,
            new ArrayList<AnnotationMetadata>()));
    if (addParamsParameter) {
        List<JavaType> typeParams = new ArrayList<JavaType>();
        typeParams.add(JavaType.STRING);
        typeParams.add(new JavaType("java.lang.Object"));
        JavaType hashMap = new JavaType("java.util.HashMap", 0,
                DataType.TYPE, null, typeParams);
        paramTypes.add(new AnnotatedJavaType(hashMap,
                new ArrayList<AnnotationMetadata>()));
    }
    paramTypes.add(new AnnotatedJavaType(new JavaType(
            "javax.servlet.http.HttpServletRequest"),
            new ArrayList<AnnotationMetadata>()));
    return paramTypes;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:ModalDialogMetadata.java

示例6: getListMethod

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private MethodMetadata getListMethod() {
    JavaSymbolName methodName = new JavaSymbolName("list");

    MethodMetadata method = methodExists(methodName);
    if (method != null) {
        return method;
    }

    List<JavaType> typeParams = new ArrayList<JavaType>();
    typeParams.add(this.entity);
    JavaType returnType = new JavaType("java.util.List", 0, DataType.TYPE,
            null, typeParams);

    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    bodyBuilder.appendFormalLine("return "
            + this.entity.getNameIncludingTypeParameters(false,
                    this.builder.getImportRegistrationResolver())
            + "."
            + new JpaCrudAnnotationValues(this.entityMetadata)
                    .getFindAllMethod().concat(
                            this.entityMetadata.getPlural()) + "();");
    return new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName,
            returnType, null, null, bodyBuilder).build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:FlexScaffoldMetadata.java

示例7: RepositoryElasticsearchMetadata

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * 
 * @param identifier
 * @param aspectName
 * @param governorPhysicalTypeMetadata
 */
protected RepositoryElasticsearchMetadata(String identifier, JavaType aspectName, 
      PhysicalTypeMetadata governorPhysicalTypeMetadata,
      final RepositoryElasticsearchAnnotationValues annotationValues){
   super(identifier, aspectName, governorPhysicalTypeMetadata);
   
   Validate.notNull(annotationValues, "Annotation values required");
   
   // Make the user's Repository interface extend Spring Data's Repository
   // interface if it doesn't already.
   ensureGovernorExtends(new JavaType(SPRING_DATA_REPOSITORY, 0,
           DataType.TYPE, null, Arrays.asList(
                   annotationValues.getDomainType(), JavaType.STRING)));

   builder.addAnnotation(getTypeAnnotation(SpringJavaType.REPOSITORY));
   
   // Build the ITD.
   itdTypeDetails = builder.build();
}
 
开发者ID:lbroudoux,项目名称:spring-roo-addon-layers-repository-elasticsearch,代码行数:25,代码来源:RepositoryElasticsearchMetadata.java

示例8: getListInnerClass

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Gets Inner class to manage elements list for batch operations
 * 
 * @return
 */
public ClassOrInterfaceTypeDetails getListInnerClass() {
    // Generate inner class name
    JavaType listInnerClassJavaType = new JavaType(destination
            .getSimpleTypeName().concat("List"), 0, DataType.TYPE, null,
            null);

    // Create class builder
    ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            getId(), Modifier.STATIC | Modifier.PUBLIC,
            listInnerClassJavaType, PhysicalTypeCategory.CLASS);

    // Add fields
    FieldMetadata listField = getListInner_field("list", destination)
            .build();
    FieldMetadata selectedField = getListInner_field("selected",
            new JavaType("Integer")).build();
    classBuilder.addField(listField);
    classBuilder.addField(selectedField);

    // Adds getter/setter for list field
    classBuilder.addMethod(getListInner_getter(listField));
    classBuilder.addMethod(getListInner_setter(listField));

    // Adds getter/setter for selected field
    classBuilder.addMethod(getListInner_getter(selectedField));
    classBuilder.addMethod(getListInner_setter(selectedField));

    // Return generated class
    return classBuilder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:36,代码来源:EntityBatchMetadata.java

示例9: getMultipleEntityIdField

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private FieldMetadataBuilder getMultipleEntityIdField(
		final JavaSymbolName fieldName) {
	builder.getImportRegistrationResolver().addImport(HASH_SET);
	return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, fieldName,
			new JavaType(SET.getFullyQualifiedTypeName(), 0, DataType.TYPE,
					null, Collections.singletonList(GAE_DATASTORE_KEY)),
			"new HashSet<Key>()");
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:9,代码来源:JavaBeanMetadata.java

示例10: RepositoryJpaMetadata

import org.springframework.roo.model.DataType; //导入依赖的package包/类
/**
 * Constructor
 * 
 * @param identifier the identifier for this item of metadata (required)
 * @param aspectName the Java type of the ITD (required)
 * @param governorPhysicalTypeMetadata the governor, which is expected to
 *            contain a {@link ClassOrInterfaceTypeDetails} (required)
 * @param annotationValues (required)
 * @param identifierType the type of the entity's identifier field
 *            (required)
 */
public RepositoryJpaMetadata(final String identifier,
        final JavaType aspectName,
        final PhysicalTypeMetadata governorPhysicalTypeMetadata,
        final RepositoryJpaAnnotationValues annotationValues,
        final JavaType identifierType) {
    super(identifier, aspectName, governorPhysicalTypeMetadata);
    Validate.notNull(annotationValues, "Annotation values required");
    Validate.notNull(identifierType, "Id type required");

    // Make the user's Repository interface extend Spring Data's
    // JpaRepository interface if it doesn't already
    ensureGovernorExtends(new JavaType(SPRING_JPA_REPOSITORY, 0,
            DataType.TYPE, null, Arrays.asList(
                    annotationValues.getDomainType(), identifierType)));

    // ... and likewise extend JpaSpecificationExecutor<Foo>, to allow query
    // by specification
    ensureGovernorExtends(new JavaType(SPRING_JPA_SPECIFICATION_EXECUTOR,
            0, DataType.TYPE, null, Arrays.asList(annotationValues
                    .getDomainType())));

    builder.addAnnotation(new AnnotationMetadataBuilder(
            SpringJavaType.REPOSITORY));

    // Build the ITD
    itdTypeDetails = builder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:39,代码来源:RepositoryJpaMetadata.java

示例11: getManyToManyInverseSideField

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private FieldMetadataBuilder getManyToManyInverseSideField(
        final JavaSymbolName fieldName,
        final JavaSymbolName mappedByFieldName,
        final Table owningSideTable, final CascadeAction onUpdate,
        final CascadeAction onDelete) {
    final JavaType element = DbreTypeUtils.findTypeForTable(
            managedEntities, owningSideTable);
    Validate.notNull(
            element,
            "Attempted to create many-to-many inverse-side field '%s' in '%s' %s",
            fieldName, destination.getFullyQualifiedTypeName(),
            getErrorMsg(owningSideTable.getFullyQualifiedTableName()));

    final List<JavaType> params = Arrays.asList(element);
    final JavaType fieldType = new JavaType(
            SET.getFullyQualifiedTypeName(), 0, DataType.TYPE, null, params);

    // Add annotations to field
    final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
    final AnnotationMetadataBuilder manyToManyBuilder = new AnnotationMetadataBuilder(
            MANY_TO_MANY);
    manyToManyBuilder.addStringAttribute(MAPPED_BY,
            mappedByFieldName.getSymbolName());
    addCascadeType(manyToManyBuilder, onUpdate, onDelete);
    annotations.add(manyToManyBuilder);

    return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, annotations,
            fieldName, fieldType);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:30,代码来源:DbreMetadata.java

示例12: getOneToManyMappedByField

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private FieldMetadataBuilder getOneToManyMappedByField(
        final JavaSymbolName fieldName,
        final JavaSymbolName mappedByFieldName,
        final String foreignTableName, final String foreignSchemaName,
        final CascadeAction onUpdate, final CascadeAction onDelete) {
    final JavaType element = DbreTypeUtils.findTypeForTableName(
            managedEntities, foreignTableName, foreignSchemaName);
    Validate.notNull(
            element,
            "Attempted to create one-to-many mapped-by field '%s' in '%s' %s",
            fieldName, destination.getFullyQualifiedTypeName(),
            getErrorMsg(foreignTableName + "." + foreignSchemaName));

    final JavaType fieldType = new JavaType(
            SET.getFullyQualifiedTypeName(), 0, DataType.TYPE, null,
            Arrays.asList(element));
    // Add @OneToMany annotation
    final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
    final AnnotationMetadataBuilder oneToManyBuilder = new AnnotationMetadataBuilder(
            ONE_TO_MANY);
    oneToManyBuilder.addStringAttribute(MAPPED_BY,
            mappedByFieldName.getSymbolName());
    addCascadeType(oneToManyBuilder, onUpdate, onDelete);
    annotations.add(oneToManyBuilder);

    return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, annotations,
            fieldName, fieldType);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:29,代码来源:DbreMetadata.java

示例13: getIndexEntityMethod

import org.springframework.roo.model.DataType; //导入依赖的package包/类
private MethodMetadataBuilder getIndexEntityMethod() {
    final JavaSymbolName methodName = new JavaSymbolName(
            annotationValues.getIndexMethod()
                    + destination.getSimpleTypeName());
    final JavaType parameterType = destination;
    if (governorHasMethod(methodName, parameterType)) {
        return null;
    }

    final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    final JavaType listType = JavaType.getInstance(List.class.getName(), 0,
            DataType.TYPE, null, parameterType);
    final JavaType arrayListType = JavaType.getInstance(
            ArrayList.class.getName(), 0, DataType.TYPE, null,
            parameterType);
    bodyBuilder.appendFormalLine(getSimpleName(listType) + " "
            + beanPlural.toLowerCase() + " = new "
            + getSimpleName(arrayListType) + "();");
    bodyBuilder.appendFormalLine(beanPlural.toLowerCase() + ".add("
            + javaBeanFieldName + ");");
    bodyBuilder.appendFormalLine(annotationValues.getIndexMethod()
            + beanPlural + "(" + beanPlural.toLowerCase() + ");");

    final List<JavaSymbolName> parameterNames = Arrays
            .asList(new JavaSymbolName(javaBeanFieldName));

    return new MethodMetadataBuilder(getId(), Modifier.PUBLIC
            | Modifier.STATIC, methodName, JavaType.VOID_PRIMITIVE,
            AnnotatedJavaType.convertFromJavaTypes(parameterType),
            parameterNames, bodyBuilder);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:32,代码来源:SolrMetadata.java

示例14: setupRepository

import org.springframework.roo.model.DataType; //导入依赖的package包/类
public void setupRepository(final JavaType interfaceType,
        final JavaType domainType) {
    Validate.notNull(interfaceType, "Interface type required");
    Validate.notNull(domainType, "Domain type required");

    final String interfaceIdentifier = getPathResolver()
            .getFocusedCanonicalPath(Path.SRC_MAIN_JAVA, interfaceType);

    if (getFileManager().exists(interfaceIdentifier)) {
        return; // Type exists already - nothing to do
    }

    // Build interface type
    final AnnotationMetadataBuilder interfaceAnnotationMetadata = new AnnotationMetadataBuilder(
            ROO_REPOSITORY_MONGO);
    interfaceAnnotationMetadata.addAttribute(new ClassAttributeValue(
            new JavaSymbolName("domainType"), domainType));
    final String interfaceMdId = PhysicalTypeIdentifier.createIdentifier(
            interfaceType, getPathResolver().getPath(interfaceIdentifier));
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            interfaceMdId, Modifier.PUBLIC, interfaceType,
            PhysicalTypeCategory.INTERFACE);
    cidBuilder.addAnnotation(interfaceAnnotationMetadata.build());
    final JavaType listType = new JavaType(List.class.getName(), 0,
            DataType.TYPE, null, Arrays.asList(domainType));
    cidBuilder.addMethod(new MethodMetadataBuilder(interfaceMdId, 0,
            new JavaSymbolName("findAll"), listType,
            new InvocableMemberBodyBuilder()));
    getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build());
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:31,代码来源:MongoOperationsImpl.java

示例15: getInitializer

import org.springframework.roo.model.DataType; //导入依赖的package包/类
@Override
public JavaType getInitializer() {
    final List<JavaType> params = new ArrayList<JavaType>();
    params.add(getGenericParameterTypeName());
    return new JavaType(ARRAY_LIST.getFullyQualifiedTypeName(), 0,
            DataType.TYPE, null, params);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:8,代码来源:ListField.java


注:本文中的org.springframework.roo.model.DataType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。