- 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 Summary
Modifier and TypeMethodDescriptionhandleCollision(T entry, String name, int failureCount) Computes an alternate name for an entry when a collision occurs in a namespace.
-
Method Details
-
handleCollision
Computes an alternate name for an entry when a collision occurs in a namespace.- Parameters:
entry- the object added to the namespacename- the name requested to be associated with the object in the namespacefailureCount- the number of times the collision handler has been invoked for this object- Returns:
- a new name to associate with the object. Returning
nullindicates the object should replace the existing entry associated with the name.
-