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


Java Table类代码示例

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


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

示例1: oneTimeTearDown

import com.datastax.driver.mapping.annotations.Table; //导入依赖的package包/类
@AfterClass
public static void oneTimeTearDown() throws UnknownHostException {
	long start = System.currentTimeMillis();
	while ((System.currentTimeMillis() - start) < 3000)
		;

	Session session = getSession();

	Set<Class<? extends SensorData>> sensorDataClasses = new Reflections(
			"de.tudarmstadt.informatik.tk.assistanceplatform.data")
			.getSubTypesOf(SensorData.class);

	for (Class<? extends SensorData> c : sensorDataClasses) {
		for (int i = 0; i < 100; i++) {
			session.execute("DELETE FROM "
					+ c.getAnnotation(Table.class).name()
					+ " WHERE user_id = 0 AND device_id = 0");
		}
	}
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:21,代码来源:CassandraPersistencyTest.java

示例2: getEntityMapperForClass

import com.datastax.driver.mapping.annotations.Table; //导入依赖的package包/类
/**
 * Factory method: found instance of <code>CassandraEntityMapper</code> from <code>mappers</code>
 * by <code>clazz</code> or create instance if not found and return it.
 *
 * @param clazz           using for searching instance of <code>CassandraEntityMapper</code> in
 *                        <code>mappers</code>
 * @param cassandraClient using when creating new instance of CassandraEntityMapper
 */
@SuppressWarnings("unchecked")
public static <E> CassandraEntityMapper<E> getEntityMapperForClass(
        Class<E> clazz,
        CassandraClient cassandraClient
) {
  CassandraEntityMapper<?> mapper = mappers.get(clazz);
  if (mapper == null) {
    if (clazz.isAnnotationPresent(Table.class)) {
      cassandraClient.getMapper(clazz);
    }
    mapper = new CassandraEntityMapper<E>(clazz, cassandraClient);
    mappers.put(clazz, mapper);
  }
  return (CassandraEntityMapper<E>) mapper;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:24,代码来源:CassandraEntityMapper.java

示例3: postProcessBeanFactory

import com.datastax.driver.mapping.annotations.Table; //导入依赖的package包/类
@SuppressWarnings("unused") // compiler bug?
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory context) throws BeansException {
	synchronized (lock) {
		ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
				false);
		scanner.addIncludeFilter(new AnnotationTypeFilter(Table.class));
		for (BeanDefinition bd : scanner.findCandidateComponents(basePackage)) {
			Class<?> entityCls;
			try {
				entityCls = Class.forName(bd.getBeanClassName());
			} catch (ClassNotFoundException e) {
				throw new AssertionError(e);
			}
			log.info("Creating proxy mapper for entity: " + entityCls.getName());
			CassandraMapper annotation = entityCls.getAnnotation(CassandraMapper.class);
			Mapper<?> bean = createProxy(Mapper.class, new MyInterceptor(entityCls, annotation.singleton()));
			String beanName;
			if (annotation == null)
				beanName = StringUtils.uncapitalize(entityCls.getSimpleName()) + "Mapper";
			else
				beanName = annotation.value();
			context.registerSingleton(beanName, bean);
			log.info("Bean registed, name=" + beanName + ", bean=" + bean.toString());
		}
	}
}
 
开发者ID:NewTranx,项目名称:newtranx-utils,代码行数:28,代码来源:MapperScannerConfigurer.java

示例4: extractSchemaName

import com.datastax.driver.mapping.annotations.Table; //导入依赖的package包/类
private static String extractSchemaName(Class<?> c) {
  Table tableAnnotation = c.getAnnotation(Table.class);
  UDT udtAnnotation = c.getAnnotation(UDT.class);

  if (tableAnnotation != null) {
    return tableAnnotation.name();
  } else if (udtAnnotation != null) {
    return udtAnnotation.name();
  }

  return null;
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:13,代码来源:CassandraSchemaGenerator.java

示例5: getTableAnnotation

import com.datastax.driver.mapping.annotations.Table; //导入依赖的package包/类
/**
 * Add Table annotation to class.
 */
private static AnnotationSpec getTableAnnotation(String keyspace, String name) {
    return AnnotationSpec.builder(Table.class).addMember("keyspace", "$S", keyspace)
            .addMember("name", "$S", name).build();
}
 
开发者ID:jtruelove,项目名称:exovert,代码行数:8,代码来源:TableGenerator.java


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