Class AliasMap.Builder

  • Enclosing class:
    AliasMap

    public static class AliasMap.Builder
    extends Object
    Builder class for the AliasMap.
    • Method Detail

      • put

        @Nonnull
        public AliasMap.Builder put​(@Nonnull
                                    CorrelationIdentifier source,
                                    @Nonnull
                                    CorrelationIdentifier target)
        Put a new binding between source and target. Note that if there is already a binding for source, the binding will remain untouched if target.equals(oldTarget), it will be replaced with source -> target otherwise. Also, putting a binding for a target that already exists will fail.
        Parameters:
        source - a source alias
        target - a target alias
        Returns:
        this that has been modified to contain source -> target
        Throws:
        IllegalArgumentException - if target is already contained in the builder
      • putAll

        @Nonnull
        public AliasMap.Builder putAll​(@Nonnull
                                       AliasMap other)
        Put all binding that are contained in another AliasMap. Note that if there are already bindings for sources contained in other, these bindings will remain untouched if target.equals(oldTarget), they will be replaced otherwise. Also, this call will fail if a target contained in other already exists in this,
        Parameters:
        other - another AliasMap
        Returns:
        this that has been modified to contain all bindings from other
        Throws:
        IllegalArgumentException - if any target contained in other is already contained in the builder
      • identitiesFor

        @Nonnull
        public AliasMap.Builder identitiesFor​(Set<CorrelationIdentifier> aliases)
        Method to update the builder to contain entries a -> a, b -> b, ... for each alias contained in the set of CorrelationIdentifiers passed in.
        Parameters:
        aliases - set of aliases that this method should create identity-bindings for
        Returns:
        this that has been modified to contain identity-bindings for all aliases contained in aliases
      • build

        @Nonnull
        public AliasMap build()
        Build a new AliasMap. This will entail a copy of the mappings in order to gain immutability guarantees.
        Returns:
        a new AliasMap