Class ClassRegistry


  • public final class ClassRegistry
    extends Object
    Holds the classes a GraphBinary, GraphSON or Gryo Class value 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 a TraversalStrategy, which belongs to TraversalStrategies.GlobalCache.

    lookup(String) also falls back to GlobalCache.getRegisteredStrategyClassByFullName, so a strategy the selector can construct is nameable without being registered here.

    • Method Detail

      • register

        public static void register​(Class<?> clazz)
        Registers a class as nameable as a generic Class value, without making it constructible from a serialized traversal, so it cannot widen what the selector can construct. A TraversalStrategy is refused with an IllegalArgumentException and a null with a NullPointerException.
      • lookup

        public static Optional<Class<?>> lookup​(String className)
        Looks up a class nameable as a generic Class value, without loading it. Matching is on the exact Class.getName(), never assignability, so registering a superclass or an interface does not admit its subtypes. A null name yields an empty Optional, since a Class value can name nothing.