Class NumericPrincipal

    • Field Detail

      • id

        private final long id
    • Constructor Detail

      • NumericPrincipal

        public NumericPrincipal​(long id)
        Construct a new instance.
        Parameters:
        id - the ID of the principal
      • NumericPrincipal

        public NumericPrincipal​(String id)
                         throws NumberFormatException
        Construct a new instance from a decimal string.
        Parameters:
        id - the ID of the principal, as a string
        Throws:
        NumberFormatException - if the number is not a valid non-negative long integer
    • Method Detail

      • getId

        public long getId()
        Get the ID of the principal.
        Returns:
        the ID of the principal
      • equals

        public boolean equals​(Object obj)
        Determine whether this principal is equal to the given object.
        Specified by:
        equals in interface Principal
        Overrides:
        equals in class Object
        Parameters:
        obj - the object
        Returns:
        true if they are equal, false otherwise
      • equals

        public boolean equals​(NumericPrincipal obj)
        Determine whether this principal is equal to the given object.
        Parameters:
        obj - the object
        Returns:
        true if they are equal, false otherwise
      • hashCode

        public int hashCode()
        Get the hash code of this principal.
        Specified by:
        hashCode in interface Principal
        Overrides:
        hashCode in class Object
        Returns:
        the hash code of this principal
      • toString

        public String toString()
        Get this principal as a string.
        Specified by:
        toString in interface Principal
        Overrides:
        toString in class Object
        Returns:
        this principal as a string (not null)
      • getName

        public String getName()
        Returns the name of this principal, which is just the string representation of the ID.
        Specified by:
        getName in interface Principal
        Returns:
        the name of this principal (not null)