Class ClassRegistry
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.structure.io.ClassRegistry
-
public final class ClassRegistry extends Object
Holds the classes a GraphBinary, GraphSON or GryoClassvalue may name, so such a name is resolved from this registry rather than by a class loader. Registration is a Java API only and refuses aTraversalStrategy, which belongs toTraversalStrategies.GlobalCache.lookup(String)also falls back toGlobalCache.getRegisteredStrategyClassByFullName, so a strategy the selector can construct is nameable without being registered here.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<Class<?>>lookup(String className)Looks up a class nameable as a genericClassvalue, without loading it.static voidregister(Class<?> clazz)Registers a class as nameable as a genericClassvalue, without making it constructible from a serialized traversal, so it cannot widen what the selector can construct.static voidunregister(Class<?> clazz)Removes a class from this registry, so it is no longer nameable as a genericClassvalue.
-
-
-
Method Detail
-
register
public static void register(Class<?> clazz)
Registers a class as nameable as a genericClassvalue, without making it constructible from a serialized traversal, so it cannot widen what the selector can construct. ATraversalStrategyis refused with anIllegalArgumentExceptionand anullwith aNullPointerException.
-
unregister
public static void unregister(Class<?> clazz)
Removes a class from this registry, so it is no longer nameable as a genericClassvalue. ATraversalStrategyis refused because strategies belong toTraversalStrategies.GlobalCache, and anullis refused with aNullPointerException.
-
lookup
public static Optional<Class<?>> lookup(String className)
Looks up a class nameable as a genericClassvalue, without loading it. Matching is on the exactClass.getName(), never assignability, so registering a superclass or an interface does not admit its subtypes. Anullname yields an emptyOptional, since aClassvalue can name nothing.
-
-