本文整理汇总了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");
}
示例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");
}
示例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");
}
示例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");
}
示例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;
}
示例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());
}
}
示例7: init
import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
MappingManager manager = new MappingManager (session);
pictureSearchCounterAccessor = manager.createAccessor(PictureSearchCounterAccessor.class);
}
示例8: init
import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
MappingManager manager = new MappingManager (session);
generalCounterAccessor = manager.createAccessor(GeneralCounterAccessor.class);
}
示例9: init
import com.datastax.driver.mapping.MappingManager; //导入方法依赖的package包/类
@PostConstruct
public void init() {
MappingManager manager = new MappingManager (session);
userCounterAccessor = manager.createAccessor(UserCounterAccessor.class);
}