Interface CollisionPolicy<T>

  • Type Parameters:
    T - the type of object stored in the namespace

    public interface CollisionPolicy<T>
    Handler for name collisions within a namespace. By specifying a CollisionPolicy, a user can control the behavior of a NamespaceBuilder when an add requests the use of a name already associated with another entry.

    A number of common policies are defined in NamespaceBuilder. Refer to the Javadoc there for details.

    • Method Detail

      • handleCollision

        String handleCollision​(T entry,
                               String name,
                               int failureCount)
        Computes an alternate name for an entry when a collision occurs in a namespace.
        Parameters:
        entry - the object added to the namespace
        name - the name requested to be associated with the object in the namespace
        failureCount - the number of times the collision handler has been invoked for this object
        Returns:
        a new name to associate with the object. Returning null indicates the object should replace the existing entry associated with the name.