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); } }
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 e) { // Trying with empty parser return getRawAbstractType(typeClass, EMPTY_PARSER); } catch (IllegalAccessException e) { // Trying with empty parser return getRawAbstractType(typeClass, EMPTY_PARSER); } }
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); } }
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); } }
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); } }
private static AbstractType<?> getAbstractType(String compareWith, TypeParser parser) throws SyntaxException, ConfigurationException { String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith; Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type"); try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
private static AbstractType<?> getAbstractType(String compareWith, TypeParser parser) throws SyntaxException, ConfigurationException { String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith; Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type"); try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
private static AbstractType<?> getAbstractType(String compareWith, TypeParser parser) throws SyntaxException, ConfigurationException { String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith; Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type"); try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
private static AbstractType<?> getAbstractType(String compareWith, TypeParser parser) throws SyntaxException, ConfigurationException { String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith; Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type"); try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
private static AbstractType<?> getAbstractType(String compareWith, TypeParser parser) throws SyntaxException, ConfigurationException { String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith; Class<? extends AbstractType<?>> typeClass = FBUtilities.<AbstractType<?>>classForName(className, "abstract-type"); try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (IllegalAccessException e) { // Trying to see if we have an instance field and apply the default parameter to it AbstractType<?> type = getRawAbstractType(typeClass); return AbstractType.parseDefaultParameters(type, parser); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }