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


Java ClassOrInterfaceTypeDetails.getDeclaredByMetadataId方法代码示例

本文整理汇总了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails.getDeclaredByMetadataId方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceTypeDetails.getDeclaredByMetadataId方法的具体用法?Java ClassOrInterfaceTypeDetails.getDeclaredByMetadataId怎么用?Java ClassOrInterfaceTypeDetails.getDeclaredByMetadataId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails的用法示例。


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

示例1: getServiceInterfaces

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public Collection<ClassOrInterfaceTypeDetails> getServiceInterfaces(
        final JavaType domainType) {
    final Set<ClassOrInterfaceTypeDetails> located = typeLocationService
            .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_SERVICE);
    final Map<String, ClassOrInterfaceTypeDetails> toReturn = new HashMap<String, ClassOrInterfaceTypeDetails>();
    for (final ClassOrInterfaceTypeDetails cid : located) {
        final ServiceAnnotationValues annotationValues = new ServiceAnnotationValues(
                new DefaultPhysicalTypeMetadata(
                        cid.getDeclaredByMetadataId(),
                        typeLocationService
                                .getPhysicalTypeCanonicalPath(cid
                                        .getDeclaredByMetadataId()), cid));
        Validate.notNull(
                annotationValues.getDomainTypes(),
                "The \"domainTypes\" attribute of @RooService for type %s must be an array of types",
                cid.getName().getFullyQualifiedTypeName());
        for (final JavaType javaType : annotationValues.getDomainTypes()) {
            if (javaType != null && javaType.equals(domainType)) {
                toReturn.put(cid.getDeclaredByMetadataId(), cid);
            }
        }
    }
    return toReturn.values();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:ServiceInterfaceLocatorImpl.java

示例2: getParentMetadata

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
 * Looks up the given type's inheritance hierarchy for metadata of the given
 * type, starting with the given type's parent and going upwards until the
 * first such instance is found (i.e. lower level metadata takes priority
 * over higher level metadata)
 * 
 * @param <T> the type of metadata to look for
 * @param child the child type whose parents to search (required)
 * @return <code>null</code> if there is no such metadata
 */
@SuppressWarnings("unchecked")
protected <T extends MetadataItem> T getParentMetadata(
        final ClassOrInterfaceTypeDetails child) {
    T parentMetadata = null;
    ClassOrInterfaceTypeDetails superCid = child.getSuperclass();
    while (parentMetadata == null && superCid != null) {
        final String superCidPhysicalTypeIdentifier = superCid
                .getDeclaredByMetadataId();
        final LogicalPath path = PhysicalTypeIdentifier
                .getPath(superCidPhysicalTypeIdentifier);
        final String superCidLocalIdentifier = createLocalIdentifier(
                superCid.getName(), path);
        parentMetadata = (T) getMetadataService().get(superCidLocalIdentifier);
        superCid = superCid.getSuperclass();
    }
    return parentMetadata; // Could be null
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:28,代码来源:AbstractItdMetadataProvider.java

示例3: contents

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
@CliCommand(value = "field file", help = "Adds a byte array field for storing uploaded file contents (JSF-scaffolded UIs only)")
public void addFileUploadField(
        @CliOption(key = { "", "fieldName" }, mandatory = true, help = "The name of the file upload field to add") final JavaSymbolName fieldName,
        @CliOption(key = "class", mandatory = false, unspecifiedDefaultValue = "*", optionContext = UPDATE_PROJECT, help = "The name of the class to receive this field") final JavaType typeName,
        @CliOption(key = "contentType", mandatory = true, help = "The content type of the file") final UploadedFileContentType contentType,
        @CliOption(key = "autoUpload", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Whether the file is uploaded automatically when selected") final boolean autoUpload,
        @CliOption(key = "column", mandatory = false, help = "The JPA @Column name") final String column,
        @CliOption(key = "notNull", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether this value cannot be null") final boolean notNull,
        @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo") final boolean permitReservedWords) {

    final ClassOrInterfaceTypeDetails cid = typeLocationService
            .getTypeDetails(typeName);
    Validate.notNull(cid, "The type specified, '%s', doesn't exist",
            typeName);

    final String physicalTypeIdentifier = cid.getDeclaredByMetadataId();
    final UploadedFileField fieldDetails = new UploadedFileField(
            physicalTypeIdentifier, fieldName, contentType);
    fieldDetails.setAutoUpload(autoUpload);
    fieldDetails.setNotNull(notNull);
    if (column != null) {
        fieldDetails.setColumn(column);
    }

    insertField(fieldDetails, permitReservedWords, false);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:27,代码来源:FieldCommands.java

示例4: getRepositories

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public Collection<ClassOrInterfaceTypeDetails> getRepositories(
        final JavaType domainType) {
    if (!cacheMap.containsKey(domainType)) {
        cacheMap.put(domainType, new HashSet<ClassOrInterfaceTypeDetails>());
    }
    final Set<ClassOrInterfaceTypeDetails> existing = cacheMap
            .get(domainType);
    final Set<ClassOrInterfaceTypeDetails> located = typeLocationService
            .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_REPOSITORY_JPA);
    if (existing.containsAll(located)) {
        return existing;
    }
    final Map<String, ClassOrInterfaceTypeDetails> toReturn = new HashMap<String, ClassOrInterfaceTypeDetails>();
    for (final ClassOrInterfaceTypeDetails cid : located) {
        final RepositoryJpaAnnotationValues annotationValues = new RepositoryJpaAnnotationValues(
                new DefaultPhysicalTypeMetadata(
                        cid.getDeclaredByMetadataId(),
                        typeLocationService
                                .getPhysicalTypeCanonicalPath(cid
                                        .getDeclaredByMetadataId()), cid));
        if (annotationValues.getDomainType() != null
                && annotationValues.getDomainType().equals(domainType)) {
            toReturn.put(cid.getDeclaredByMetadataId(), cid);
        }
    }
    return toReturn.values();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:28,代码来源:RepositoryJpaLocatorImpl.java

示例5: injectJmsTemplate

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public void injectJmsTemplate(final JavaType targetType,
        final JavaSymbolName fieldName, final boolean asynchronous) {
    Validate.notNull(targetType, "Java type required");
    Validate.notNull(fieldName, "Field name required");

    final ClassOrInterfaceTypeDetails targetTypeDetails = typeLocationService
            .getTypeDetails(targetType);
    Validate.isTrue(targetTypeDetails != null,
            "Cannot locate source for '%s'",
            targetType.getFullyQualifiedTypeName());

    final String declaredByMetadataId = targetTypeDetails
            .getDeclaredByMetadataId();
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            targetTypeDetails);

    // Create the field
    cidBuilder.addField(new FieldMetadataBuilder(declaredByMetadataId,
            PRIVATE | TRANSIENT, Arrays
                    .asList(new AnnotationMetadataBuilder(AUTOWIRED)),
            fieldName, JMS_OPERATIONS));

    // Create the method
    cidBuilder.addMethod(createSendMessageMethod(fieldName,
            declaredByMetadataId, asynchronous));

    if (asynchronous) {
        ensureSpringAsynchronousSupportEnabled();
    }

    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:JmsOperationsImpl.java

示例6: getRepositories

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public Collection<ClassOrInterfaceTypeDetails> getRepositories(
        final JavaType domainType) {
    if (!cacheMap.containsKey(domainType)) {
        cacheMap.put(domainType, new HashSet<ClassOrInterfaceTypeDetails>());
    }
    final Set<ClassOrInterfaceTypeDetails> existing = cacheMap
            .get(domainType);
    final Set<ClassOrInterfaceTypeDetails> located = typeLocationService
            .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_REPOSITORY_MONGO);
    if (existing.containsAll(located)) {
        return existing;
    }
    final Map<String, ClassOrInterfaceTypeDetails> toReturn = new HashMap<String, ClassOrInterfaceTypeDetails>();
    for (final ClassOrInterfaceTypeDetails cid : located) {
        final RepositoryMongoAnnotationValues annotationValues = new RepositoryMongoAnnotationValues(
                new DefaultPhysicalTypeMetadata(
                        cid.getDeclaredByMetadataId(),
                        typeLocationService
                                .getPhysicalTypeCanonicalPath(cid
                                        .getDeclaredByMetadataId()), cid));
        if (annotationValues.getDomainType() != null
                && annotationValues.getDomainType().equals(domainType)) {
            toReturn.put(cid.getDeclaredByMetadataId(), cid);
        }
    }
    return toReturn.values();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:28,代码来源:RepositoryMongoLocatorImpl.java

示例7: addFieldEnum

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
@CliCommand(value = "field enum", help = "Adds a private enum field to an existing Java source file")
public void addFieldEnum(
        @CliOption(key = { "", "fieldName" }, mandatory = true, help = "The name of the field to add") final JavaSymbolName fieldName,
        @CliOption(key = "type", mandatory = true, help = "The enum type of this field") final JavaType fieldType,
        @CliOption(key = "class", mandatory = false, unspecifiedDefaultValue = "*", optionContext = UPDATE_PROJECT, help = "The name of the class to receive this field") final JavaType typeName,
        @CliOption(key = "column", mandatory = false, help = "The JPA @Column name") final String column,
        @CliOption(key = "notNull", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether this value cannot be null") final boolean notNull,
        @CliOption(key = "nullRequired", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether this value must be null") final boolean nullRequired,
        @CliOption(key = "enumType", mandatory = false, help = "The fetch semantics at a JPA level") final EnumType enumType,
        @CliOption(key = "comment", mandatory = false, help = "An optional comment for JavaDocs") final String comment,
        @CliOption(key = "transient", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates to mark the field as transient") final boolean transientModifier,
        @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo") final boolean permitReservedWords) {

    final ClassOrInterfaceTypeDetails cid = typeLocationService
            .getTypeDetails(typeName);
    Validate.notNull(cid, "The type specified, '%s', doesn't exist",
            typeName);

    final String physicalTypeIdentifier = cid.getDeclaredByMetadataId();
    final EnumField fieldDetails = new EnumField(physicalTypeIdentifier,
            fieldType, fieldName);
    if (column != null) {
        fieldDetails.setColumn(column);
    }
    fieldDetails.setNotNull(notNull);
    fieldDetails.setNullRequired(nullRequired);
    if (enumType != null) {
        fieldDetails.setEnumType(enumType);
    }
    if (comment != null) {
        fieldDetails.setComment(comment);
    }

    insertField(fieldDetails, permitReservedWords, transientModifier);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:36,代码来源:FieldCommands.java

示例8: addFieldEmbeddedJpa

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
@CliCommand(value = "field embedded", help = "Adds a private @Embedded field to an existing Java source file ")
public void addFieldEmbeddedJpa(
        @CliOption(key = { "", "fieldName" }, mandatory = true, help = "The name of the field to add") final JavaSymbolName fieldName,
        @CliOption(key = "type", mandatory = true, optionContext = PROJECT, help = "The Java type of the @Embeddable class") final JavaType fieldType,
        @CliOption(key = "class", mandatory = false, unspecifiedDefaultValue = "*", optionContext = UPDATE_PROJECT, help = "The name of the @Entity class to receive this field") final JavaType typeName,
        @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo") final boolean permitReservedWords) {

    // Check if the field type is a JPA @Embeddable class
    final ClassOrInterfaceTypeDetails cid = typeLocationService
            .getTypeDetails(fieldType);
    Validate.notNull(
            cid,
            "The specified target '--type' does not exist or can not be found. Please create this type first.");
    Validate.notNull(cid.getAnnotation(EMBEDDABLE),
            "The field embedded command is only applicable to JPA @Embeddable field types.");

    // Check if the requested entity is a JPA @Entity
    final ClassOrInterfaceTypeDetails javaTypeDetails = typeLocationService
            .getTypeDetails(typeName);
    Validate.notNull(javaTypeDetails,
            "The type specified, '%s', doesn't exist", typeName);

    final String physicalTypeIdentifier = javaTypeDetails
            .getDeclaredByMetadataId();
    final PhysicalTypeMetadata targetTypeMetadata = (PhysicalTypeMetadata) metadataService
            .get(physicalTypeIdentifier);
    Validate.notNull(
            targetTypeMetadata,
            "The specified target '--class' does not exist or can not be found. Please create this type first.");
    final PhysicalTypeDetails targetPtd = targetTypeMetadata
            .getMemberHoldingTypeDetails();
    Validate.isInstanceOf(MemberHoldingTypeDetails.class, targetPtd);

    final ClassOrInterfaceTypeDetails targetTypeCid = (ClassOrInterfaceTypeDetails) targetPtd;
    final MemberDetails memberDetails = memberDetailsScanner
            .getMemberDetails(this.getClass().getName(), targetTypeCid);
    Validate.isTrue(
            memberDetails.getAnnotation(ENTITY) != null
                    || memberDetails.getAnnotation(PERSISTENT) != null,
            "The field embedded command is only applicable to JPA @Entity or Spring Data @Persistent target types.");

    final EmbeddedField fieldDetails = new EmbeddedField(
            physicalTypeIdentifier, fieldType, fieldName);

    insertField(fieldDetails, permitReservedWords, false);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:47,代码来源:FieldCommands.java

示例9: file

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
@CliCommand(value = "field reference", help = "Adds a private reference field to an existing Java source file (eg the 'many' side of a many-to-one)")
public void addFieldReferenceJpa(
        @CliOption(key = { "", "fieldName" }, mandatory = true, help = "The name of the field to add") final JavaSymbolName fieldName,
        @CliOption(key = "type", mandatory = true, optionContext = PROJECT, help = "The Java type of the entity to reference") final JavaType fieldType,
        @CliOption(key = "class", mandatory = false, unspecifiedDefaultValue = "*", optionContext = UPDATE_PROJECT, help = "The name of the class to receive this field") final JavaType typeName,
        @CliOption(key = "notNull", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether this value cannot be null") final boolean notNull,
        @CliOption(key = "nullRequired", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether this value must be null") final boolean nullRequired,
        @CliOption(key = "joinColumnName", mandatory = false, help = "The JPA @JoinColumn name") final String joinColumnName,
        @CliOption(key = "referencedColumnName", mandatory = false, help = "The JPA @JoinColumn referencedColumnName") final String referencedColumnName,
        @CliOption(key = "cardinality", mandatory = false, unspecifiedDefaultValue = "MANY_TO_ONE", specifiedDefaultValue = "MANY_TO_ONE", help = "The relationship cardinality at a JPA level") final Cardinality cardinality,
        @CliOption(key = "fetch", mandatory = false, help = "The fetch semantics at a JPA level") final Fetch fetch,
        @CliOption(key = "comment", mandatory = false, help = "An optional comment for JavaDocs") final String comment,
        @CliOption(key = "transient", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates to mark the field as transient") final boolean transientModifier,
        @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo") final boolean permitReservedWords) {

    final ClassOrInterfaceTypeDetails cid = typeLocationService
            .getTypeDetails(fieldType);
    Validate.notNull(
            cid,
            "The specified target '--type' does not exist or can not be found. Please create this type first.");

    // Check if the requested entity is a JPA @Entity
    final MemberDetails memberDetails = memberDetailsScanner
            .getMemberDetails(this.getClass().getName(), cid);
    final AnnotationMetadata entityAnnotation = memberDetails
            .getAnnotation(ENTITY);
    final AnnotationMetadata persistentAnnotation = memberDetails
            .getAnnotation(PERSISTENT);
    Validate.isTrue(
            entityAnnotation != null || persistentAnnotation != null,
            "The field reference command is only applicable to JPA @Entity or Spring Data @Persistent target types.");

    Validate.isTrue(cardinality == Cardinality.MANY_TO_ONE
            || cardinality == Cardinality.ONE_TO_ONE,
            "Cardinality must be MANY_TO_ONE or ONE_TO_ONE for the field reference command");

    final ClassOrInterfaceTypeDetails javaTypeDetails = typeLocationService
            .getTypeDetails(typeName);
    Validate.notNull(javaTypeDetails,
            "The type specified, '%s', doesn't exist", typeName);

    final String physicalTypeIdentifier = javaTypeDetails
            .getDeclaredByMetadataId();
    final ReferenceField fieldDetails = new ReferenceField(
            physicalTypeIdentifier, fieldType, fieldName, cardinality);
    fieldDetails.setNotNull(notNull);
    fieldDetails.setNullRequired(nullRequired);
    if (joinColumnName != null) {
        fieldDetails.setJoinColumnName(joinColumnName);
    }
    if (referencedColumnName != null) {
        Validate.notNull(joinColumnName,
                "@JoinColumn name is required if specifying a referencedColumnName");
        fieldDetails.setReferencedColumnName(referencedColumnName);
    }
    if (fetch != null) {
        fieldDetails.setFetch(fetch);
    }
    if (comment != null) {
        fieldDetails.setComment(comment);
    }

    insertField(fieldDetails, permitReservedWords, transientModifier);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:65,代码来源:FieldCommands.java


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