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


Java Document类代码示例

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


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

示例1: getInititalEntityClasses

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
private static Set<String> getInititalEntityClasses(String[] domainPackages) {
    if (ArrayUtils.isEmpty(domainPackages)) {
        return null;
    }

    ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider(false);
    componentProvider.addIncludeFilter(new AnnotationTypeFilter(Document.class));
    componentProvider.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));

    Set<String> classes = new ManagedSet<>();
    for (String domainPackage : domainPackages) {
        if (StringUtils.isBlank(domainPackage)) {
            continue;
        }
        for (BeanDefinition candidate : componentProvider.findCandidateComponents(domainPackage)) {
            classes.add(candidate.getBeanClassName());
        }
    }

    return classes;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:22,代码来源:MongoBeanDefinitionRegistrar.java

示例2: getInitialEntitySet

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException {

        String basePackage = getMappingBasePackage();
        Set<Class<?>> initialEntitySet = new HashSet<Class<?>>();

        if (StringUtils.hasText(basePackage)) {
            ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider(
                    false);
            componentProvider.addIncludeFilter(new AnnotationTypeFilter(Document.class));
            componentProvider.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));

            for (BeanDefinition candidate : componentProvider.findCandidateComponents(basePackage)) {
                initialEntitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
                        this.getClass().getClassLoader()));
            }
        }

        return initialEntitySet;
    }
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:20,代码来源:AbstractRepositoryConfiguration.java

示例3: deriveCollectionName

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
protected String deriveCollectionName(Class className) throws InvalidAggregationQueryException {

    Document documentAnnotation = AnnotationUtils.findAnnotation(className, Document.class);
    String collectionName;
    if (documentAnnotation != null) {
      collectionName = documentAnnotation.collection();
      if(StringUtils.isEmpty(collectionName)) {
        collectionName = getSimpleCollectionName(className);
      }
      else {
        Expression expression = detectExpression(collectionName);
        if(expression != null) {
          collectionName = expression.getValue(context, String.class);
        }
      }
    }
    else {
      collectionName = getSimpleCollectionName(className);
    }

    Assert.notNull(collectionName);
    return collectionName;
  }
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:24,代码来源:AbstractAggregateQueryProvider.java

示例4: getInitialEntitySet

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
private Set<Class<?>> getInitialEntitySet(BeanFactory beanFactory)
		throws ClassNotFoundException {
	Set<Class<?>> entitySet = new HashSet<Class<?>>();
	ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
			false);
	scanner.setEnvironment(this.environment);
	scanner.setResourceLoader(this.resourceLoader);
	scanner.addIncludeFilter(new AnnotationTypeFilter(Document.class));
	scanner.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));
	for (String basePackage : getMappingBasePackages(beanFactory)) {
		if (StringUtils.hasText(basePackage)) {
			for (BeanDefinition candidate : scanner
					.findCandidateComponents(basePackage)) {
				entitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
						this.classLoader));
			}
		}
	}
	return entitySet;
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:21,代码来源:MongoDataAutoConfiguration.java

示例5: determineCollectionName

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
private static String determineCollectionName(Class<?> entityClass) {
	if (entityClass == null) {
		throw new InvalidDataAccessApiUsageException(
				"No class parameter provided, entity collection can't be determined!");
	}
	String collName = entityClass.getSimpleName();
	if (entityClass.isAnnotationPresent(Document.class)) {
		Document document = entityClass.getAnnotation(Document.class);
		collName = document.collection();
	} else {
		collName = collName.replaceFirst(collName.substring(0, 1), collName.substring(0, 1).toLowerCase());
	}
	return collName;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:15,代码来源:AbstractBaseMongoDao.java

示例6: mongoMappingContext

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public MongoMappingContext mongoMappingContext(BeanFactory beanFactory)
		throws ClassNotFoundException {
	MongoMappingContext context = new MongoMappingContext();
	context.setInitialEntitySet(new EntityScanner(this.applicationContext)
			.scan(Document.class, Persistent.class));
	Class<?> strategyClass = this.properties.getFieldNamingStrategy();
	if (strategyClass != null) {
		context.setFieldNamingStrategy(
				(FieldNamingStrategy) BeanUtils.instantiate(strategyClass));
	}
	return context;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MongoDataAutoConfiguration.java

示例7: init

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
@PostConstruct
public void init() {
    Class<ImMessage> messageClass = ImMessage.class;
    Document annotation = messageClass.getAnnotation(Document.class);
    collectionName = annotation == null ? messageClass.getSimpleName() : annotation.collection();
    messageCollection = messageDb.getCollection(collectionName);
}
 
开发者ID:projectsrepos,项目名称:jim,代码行数:8,代码来源:OfflineMessageRepo.java

示例8: getCollectionName

import org.springframework.data.mongodb.core.mapping.Document; //导入依赖的package包/类
public static final String getCollectionName(final Class<?> clazz) {
	String collection = null;
	if (clazz != null) {
		final Annotation annotation = clazz.getAnnotation(Document.class);
		if (annotation instanceof Document) {
			collection = ((Document)annotation).collection();
		}
		if (isBlank(collection)) collection = uncapitalize(clazz.getSimpleName());
	}
	return collection;
}
 
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:12,代码来源:AnnotationCollectionUtils.java


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