-
- Type Parameters:
T
- the type of object stored in the namespace
public interface CollisionPolicy<T>
Handler for name collisions within a namespace. By specifying aCollisionPolicy
, a user can control the behavior of aNamespaceBuilder
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
handleCollision(T entry, String name, int failureCount)
Computes an alternate name for an entry when a collision occurs in a namespace.
-
-
-
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 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
null
indicates the object should replace the existing entry associated with the name.
-
-