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


Java MappingManager.createAccessor方法代码示例

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


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

示例1: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    pictureAccesor = manager.createAccessor(PictureAccessor.class);
    generalCounterAccessor = manager.createAccessor(GeneralCounterAccessor.class);
    userCounterAccessor = manager.createAccessor(UserCounterAccessor.class);
    mapper = manager.mapper(Picture.class);
    findByIds = session.prepare("SELECT * from picture WHERE id IN ?;");
    truncateStmt = session.prepare("TRUNCATE picture");
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:11,代码来源:PictureRepository.java

示例2: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    pictureSearchAccesor = manager.createAccessor(PictureSearchAccesor.class);
    generalCounterAccessor = manager.createAccessor(GeneralCounterAccessor.class);
    pictureSearchCounterAccessor = manager.createAccessor(PictureSearchCounterAccessor.class);
    mapper = manager.mapper(PictureSearch.class);
    findAllStmt = session.prepare("SELECT * FROM pictureSearch");
    truncateStmt = session.prepare("TRUNCATE pictureSearch");
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:11,代码来源:PictureSearchRepository.java

示例3: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    pictureFoundAccessor = manager.createAccessor(PictureFoundAccessor.class);
    pictureSearchCounterAccessor = manager.createAccessor(PictureSearchCounterAccessor.class);
    mapper = manager.mapper(PictureFound.class);
    findAllStmt = session.prepare("SELECT * FROM pictureFound");
    findAllByPictureStmt = session.prepare("SELECT * FROM pictureFound WHERE picture_id = ?");
    truncateStmt = session.prepare("TRUNCATE pictureFound");
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:11,代码来源:PictureFoundRepository.java

示例4: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    metadataAccessor = manager.createAccessor(MetadataAccessor.class);
    generalCounterAccessor = manager.createAccessor(GeneralCounterAccessor.class);
    mapper = manager.mapper(Metadata.class);
    findAllStmt = session.prepare("SELECT * FROM metadata");
    truncateStmt = session.prepare("TRUNCATE metadata");
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:10,代码来源:MetadataRepository.java

示例5: CqlContentStore

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
protected CqlContentStore(Builder builder) {
    this.idGenerator = checkNotNull(builder.idGenerator);
    this.session = checkNotNull(builder.session);
    this.clock = checkNotNull(builder.clock);

    MappingManager mappingManager = new MappingManager(session);

    // TODO: bug in driver 3.1.0 prompting this hackaround. Remove when it's fixed. MBST-16715
    mappingManager.udtCodec(Description.class);
    mappingManager.udtCodec(org.atlasapi.content.v2.model.udt.BroadcastRef.class);
    mappingManager.udtCodec(org.atlasapi.content.v2.model.udt.LocationSummary.class);
    mappingManager.udtCodec(org.atlasapi.content.v2.model.udt.LocationSummary.class);
    mappingManager.udtCodec(org.atlasapi.content.v2.model.udt.ItemSummary.class);

    this.mapper = mappingManager.mapper(org.atlasapi.content.v2.model.Content.class);
    this.accessor = mappingManager.createAccessor(ContentAccessor.class);

    mapper.setDefaultGetOptions(Mapper.Option.consistencyLevel(builder.readConsistency));
    mapper.setDefaultSaveOptions(Mapper.Option.consistencyLevel(builder.writeConsistency));
    mapper.setDefaultDeleteOptions(Mapper.Option.consistencyLevel(builder.writeConsistency));

    this.sender = builder.sender;
    this.hasher = checkNotNull(builder.hasher);
    this.graphStore = checkNotNull(builder.graphStore);

    writeContent = builder.metricPrefix + "writeContent.";
    writeBroadcast = builder.metricPrefix + "writeBroadcast.";

    this.metricRegistry = builder.metricRegistry;
}
 
开发者ID:atlasapi,项目名称:atlas-deer,代码行数:31,代码来源:CqlContentStore.java

示例6: postProcessBeanFactory

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory context) throws BeansException {
	ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false) {

		@Override
		protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
			return beanDefinition.getMetadata().isInterface();
		}

	};
	scanner.addIncludeFilter(new AnnotationTypeFilter(Accessor.class));
	for (BeanDefinition bd : scanner.findCandidateComponents(basePackage)) {
		Class<?> accessorCls;
		try {
			accessorCls = Class.forName(bd.getBeanClassName());
		} catch (ClassNotFoundException e) {
			throw new AssertionError(e);
		}
		log.info("Creating proxy accessor: " + accessorCls.getName());
		MethodInterceptor interceptor = new MethodInterceptor() {

			private final Lazy<?> target = new Lazy<>(() -> {
				log.info("Creating actual accessor: " + accessorCls.getName());
				Session session;
				if (AccessorScannerConfigurer.this.session == null)
					session = mainContext.getBean(Session.class);
				else
					session = AccessorScannerConfigurer.this.session;
				MappingManager mappingManager = new MappingManager(session);
				return mappingManager.createAccessor(accessorCls);
			});

			@Override
			public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
				if ("toString".equals(method.getName())) {
					return accessorCls.getName();
				}
				return method.invoke(target.get(), args);
			}

		};
		Enhancer enhancer = new Enhancer();
		enhancer.setInterfaces(new Class<?>[] { accessorCls });
		enhancer.setCallback(interceptor);
		Object bean = enhancer.create();
		String beanName = StringUtils.uncapitalize(accessorCls.getSimpleName());
		context.registerSingleton(beanName, bean);
		log.info("Bean registed, name=" + beanName + ", bean=" + bean.toString());
	}
}
 
开发者ID:NewTranx,项目名称:newtranx-utils,代码行数:51,代码来源:AccessorScannerConfigurer.java

示例7: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    pictureSearchCounterAccessor = manager.createAccessor(PictureSearchCounterAccessor.class);
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:6,代码来源:PictureSearchCounterRepository.java

示例8: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    generalCounterAccessor = manager.createAccessor(GeneralCounterAccessor.class);
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:6,代码来源:GeneralCounterRepository.java

示例9: init

import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    MappingManager manager = new MappingManager (session);
    userCounterAccessor = manager.createAccessor(UserCounterAccessor.class);
}
 
开发者ID:dalbelap,项目名称:flipper-reverse-image-search,代码行数:6,代码来源:UserCounterRepository.java


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