Class IdentifierIssuer


  • public class IdentifierIssuer
    extends java.lang.Object
    An issuer of counted identifiers to map identifiers from one naming scheme to another.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int counter
      Counter for creating new identifiers.
      private java.util.Map<java.lang.String,​java.lang.String> existing
      Identifiers that have already been issued.
      private java.lang.String prefix
      The prefix for new identifiers.
    • Constructor Summary

      Constructors 
      Constructor Description
      IdentifierIssuer​(java.lang.String prefix)
      Create a new instance.
      IdentifierIssuer​(java.lang.String prefix, java.util.Map<java.lang.String,​java.lang.String> mapping, int counter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assign​(IdentifierIssuer other)
      Create a mapping in another issuer for all identifiers issued by this, in the same order that they were issued by this.
      IdentifierIssuer copy()
      Create a copy of this issuer.
      private java.lang.String getForBlank​(java.lang.String value)  
      java.lang.String getId​(java.lang.String id)
      Get or allocate a new ID for the specified old ID.
      java.lang.String getIfExists​(java.lang.String value)
      Get the resource replaced by a proper blank identifier if appropriate.
      boolean hasId​(java.lang.String id)
      Does an old ID have an allocated new ID?.
      java.util.Map<java.lang.String,​java.lang.String> mapping()
      Get blank nodes mapping table.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • existing

        private final java.util.Map<java.lang.String,​java.lang.String> existing
        Identifiers that have already been issued.
      • prefix

        private final java.lang.String prefix
        The prefix for new identifiers.
      • counter

        private int counter
        Counter for creating new identifiers.
    • Constructor Detail

      • IdentifierIssuer

        public IdentifierIssuer​(java.lang.String prefix)
        Create a new instance.
        Parameters:
        prefix - the prefix for new identifiers.
      • IdentifierIssuer

        public IdentifierIssuer​(java.lang.String prefix,
                                java.util.Map<java.lang.String,​java.lang.String> mapping,
                                int counter)
    • Method Detail

      • assign

        public void assign​(IdentifierIssuer other)
        Create a mapping in another issuer for all identifiers issued by this, in the same order that they were issued by this.
        Parameters:
        other - the other identifier issuer.
      • copy

        public IdentifierIssuer copy()
        Create a copy of this issuer.
        Returns:
        the issuer to copy
      • getForBlank

        private java.lang.String getForBlank​(java.lang.String value)
      • getId

        public java.lang.String getId​(java.lang.String id)
        Get or allocate a new ID for the specified old ID.
        Parameters:
        id - the old ID
        Returns:
        the new ID
      • getIfExists

        public java.lang.String getIfExists​(java.lang.String value)
        Get the resource replaced by a proper blank identifier if appropriate.
        Parameters:
        value - the resource to check
        Returns:
        the value or the replaced value
      • hasId

        public boolean hasId​(java.lang.String id)
        Does an old ID have an allocated new ID?.
        Parameters:
        id - the old ID
        Returns:
        true of a new ID has been allocated for this old ID.
      • mapping

        public java.util.Map<java.lang.String,​java.lang.String> mapping()
        Get blank nodes mapping table.
        Returns:
        a mapping table