public static List<IoRegistry> createRegistries(final List<Object> registryNamesClassesOrInstances) {
        if (registryNamesClassesOrInstances.isEmpty()) return Collections.emptyList();

        final List<IoRegistry> registries = new ArrayList<>();
        for (final Object object : registryNamesClassesOrInstances) {
            if (object instanceof IoRegistry)
                registries.add((IoRegistry) object);
            else if (object instanceof String || object instanceof Class) {
                try {
                    final Class<?> clazz = object instanceof String ? Class.forName((String) object) : (Class) object;
                    Method instanceMethod = null;
                    try {
                        instanceMethod = clazz.getDeclaredMethod("instance"); // try for getInstance() ??
                    } catch (final NoSuchMethodException e) {
                        try {
                            // even though use of "getInstance" is no longer a thing in tinkerpop as of 3.3.0, perhaps
                            // others are using this style of naming. Doesn't seem to harm anything to continue to
                            // check for that method.
                            instanceMethod = clazz.getDeclaredMethod("getInstance"); // try for getInstance() ??
                        } catch (final NoSuchMethodException e2) {
                            // no instance() or getInstance() methods
                        }
                    }
                    if (null != instanceMethod && IoRegistry.class.isAssignableFrom(instanceMethod.getReturnType()))
                        registries.add((IoRegistry) instanceMethod.invoke(null));
                    else
                        registries.add((IoRegistry) clazz.newInstance()); // no instance() or getInstance() methods, try instantiate class
                } catch (final Exception e) {
                    throw new IllegalStateException(e.getMessage(), e);
                }
            } else {
                throw new IllegalArgumentException("The provided registry object can not be resolved to an instance: " + object);
            }
        }
        return registries;
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/util/IoRegistryHelper.java