本文整理汇总了Java中org.apache.ignite.IgniteCache.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteCache.getConfiguration方法的具体用法?Java IgniteCache.getConfiguration怎么用?Java IgniteCache.getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.IgniteCache
的用法示例。
在下文中一共展示了IgniteCache.getConfiguration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createKeyObject
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
/**
* Converting entity key to cache key
*
* @param key entity key
* @return string key
*/
public Object createKeyObject(EntityKey key) {
Object result = null;
if ( key.getColumnValues().length == 1 ) {
IgniteCache<Object, BinaryObject> entityCache = getEntityCache( key.getMetadata() );
CacheConfiguration cacheConfig = entityCache.getConfiguration( CacheConfiguration.class );
result = toValidKeyObject( key.getColumnValues()[0], cacheConfig.getKeyType() );
}
else {
BinaryObjectBuilder builder = createBinaryObjectBuilder( findKeyType( key.getMetadata() ) );
for ( int i = 0; i < key.getColumnNames().length; i++ ) {
builder.setField( StringHelper.stringAfterPoint( key.getColumnNames()[i] ), key.getColumnValues()[i] );
}
result = builder.build();
}
return result;
}
示例2: findKeyType
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
/**
* Finds key type name for cache for entities with composite id
* @param keyMetadata
* @return
*/
private String findKeyType(EntityKeyMetadata keyMetadata) {
String result = compositeIdTypes.get( keyMetadata.getTable() );
if ( result == null ) {
String cacheType = getEntityTypeName( keyMetadata.getTable() );
IgniteCache<Object, BinaryObject> cache = getEntityCache( keyMetadata );
CacheConfiguration cacheConfig = cache.getConfiguration( CacheConfiguration.class );
if ( cacheConfig.getQueryEntities() != null ) {
for ( QueryEntity qe : (Collection<QueryEntity>) cacheConfig.getQueryEntities() ) {
if ( qe.getValueType() != null && cacheType.equalsIgnoreCase( qe.getValueType() ) ) {
result = qe.getKeyType();
break;
}
}
}
if ( result == null ) {
if ( cacheConfig.getKeyType() != null ) {
result = cacheConfig.getKeyType().getSimpleName();
}
if ( result == null ) {
// if nothing found we use id field name
result = StringHelper.stringBeforePoint( keyMetadata.getColumnNames()[0] );
result = StringUtils.capitalize( result );
}
}
compositeIdTypes.put( keyMetadata.getTable(), result );
}
return result;
}