private <K, V> Pair<Class<K>, Class<V>> determineMapGenericTypes(Field field) { log.trace( "Determine generic types for field Map<K,V> {} of entity class {}", field.getName(), field.getDeclaringClass().getCanonicalName()); Type genericType = field.getGenericType(); ParameterizedType pt = (ParameterizedType) genericType; Type[] actualTypeArguments = pt.getActualTypeArguments(); Class<K> keyClass = getClassFromType(actualTypeArguments[0]); Class<V> valueClass = getClassFromType(actualTypeArguments[1]); return Pair.create(keyClass, valueClass); }
public Pair<ConsistencyLevel, ConsistencyLevel> findConsistencyLevels( Field field, Pair<ConsistencyLevel, ConsistencyLevel> defaultConsistencyLevels) { log.debug( "Find consistency configuration for field {} of class {}", field.getName(), field.getDeclaringClass().getCanonicalName()); Consistency clevel = field.getAnnotation(Consistency.class); ConsistencyLevel defaultGlobalRead = defaultConsistencyLevels.left; ConsistencyLevel defaultGlobalWrite = defaultConsistencyLevels.right; if (clevel != null) { defaultGlobalRead = clevel.read(); defaultGlobalWrite = clevel.write(); } log.trace("Found consistency levels : {} / {}", defaultGlobalRead, defaultGlobalWrite); return Pair.create(defaultGlobalRead, defaultGlobalWrite); }