本文整理汇总了Java中org.apache.cassandra.utils.FBUtilities.classForName方法的典型用法代码示例。如果您正苦于以下问题:Java FBUtilities.classForName方法的具体用法?Java FBUtilities.classForName怎么用?Java FBUtilities.classForName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.FBUtilities
的用法示例。
在下文中一共展示了FBUtilities.classForName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public void validate(CFMetaData cfm)
{
if (!isNameValid(name))
throw new ConfigurationException("Illegal index name " + name);
if (kind == null)
throw new ConfigurationException("Index kind is null for index " + name);
if (kind == Kind.CUSTOM)
{
if (options == null || !options.containsKey(IndexTarget.CUSTOM_INDEX_OPTION_NAME))
throw new ConfigurationException(String.format("Required option missing for index %s : %s",
name, IndexTarget.CUSTOM_INDEX_OPTION_NAME));
String className = options.get(IndexTarget.CUSTOM_INDEX_OPTION_NAME);
Class<Index> indexerClass = FBUtilities.classForName(className, "custom indexer");
if(!Index.class.isAssignableFrom(indexerClass))
throw new ConfigurationException(String.format("Specified Indexer class (%s) does not implement the Indexer interface", className));
validateCustomIndexOptions(cfm, indexerClass, options);
}
}
示例2: getAbstractType
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private static AbstractType<?> getAbstractType(String compareWith) throws ConfigurationException
{
String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith;
Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type");
try
{
Field field = typeClass.getDeclaredField("instance");
return (AbstractType<?>) field.get(null);
}
catch (NoSuchFieldException | IllegalAccessException e)
{
// Trying with empty parser
return getRawAbstractType(typeClass, EMPTY_PARSER);
}
}
示例3: getClass
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static Class<AbstractReplicationStrategy> getClass(String cls) throws ConfigurationException
{
String className = cls.contains(".") ? cls : "org.apache.cassandra.locator." + cls;
Class<AbstractReplicationStrategy> strategyClass = FBUtilities.classForName(className, "replication strategy");
if (!AbstractReplicationStrategy.class.isAssignableFrom(strategyClass))
{
throw new ConfigurationException(String.format("Specified replication strategy class (%s) is not derived from AbstractReplicationStrategy", className));
}
return strategyClass;
}
示例4: createCompactionStrategy
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static Class<? extends AbstractCompactionStrategy> createCompactionStrategy(String className) throws ConfigurationException
{
className = className.contains(".") ? className : "org.apache.cassandra.db.compaction." + className;
Class<AbstractCompactionStrategy> strategyClass = FBUtilities.classForName(className, "compaction strategy");
if (className.equals(WrappingCompactionStrategy.class.getName()))
throw new ConfigurationException("You can't set WrappingCompactionStrategy as the compaction strategy!");
if (!AbstractCompactionStrategy.class.isAssignableFrom(strategyClass))
throw new ConfigurationException(String.format("Specified compaction strategy class (%s) is not derived from AbstractReplicationStrategy", className));
return strategyClass;
}
示例5: createCompactionStrategy
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static Class<? extends AbstractCompactionStrategy> createCompactionStrategy(String className) throws ConfigurationException
{
className = className.contains(".") ? className : "org.apache.cassandra.db.compaction." + className;
Class<AbstractCompactionStrategy> strategyClass = FBUtilities.classForName(className, "compaction strategy");
if (!AbstractCompactionStrategy.class.isAssignableFrom(strategyClass))
throw new ConfigurationException(String.format("Specified compaction strategy class (%s) is not derived from AbstractReplicationStrategy", className));
return strategyClass;
}
示例6: classFromName
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private static Class<? extends AbstractCompactionStrategy> classFromName(String name)
{
String className = name.contains(".")
? name
: "org.apache.cassandra.db.compaction." + name;
Class<AbstractCompactionStrategy> strategyClass = FBUtilities.classForName(className, "compaction strategy");
if (!AbstractCompactionStrategy.class.isAssignableFrom(strategyClass))
{
throw new ConfigurationException(format("Compaction strategy class %s is not derived from AbstractReplicationStrategy",
className));
}
return strategyClass;
}