Class CityId

  • All Implemented Interfaces:
    java.lang.Comparable<CityId>

    public class CityId
    extends java.lang.Object
    implements java.lang.Comparable<CityId>
    Represent a city identifier
    • Constructor Summary

      Constructors 
      Constructor Description
      CityId​(java.lang.String value)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(CityId other)
      Redefinition of compareTo
      boolean equals​(java.lang.Object other)
      Redefinition of equals
      java.lang.String getValue()
      Getter
      int hashCode()
      Redefinition of hashCode
      int length()
      Getter
      java.lang.String toString()
      Redefinition of toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CityId

        public CityId​(java.lang.String value)
        Constructor
        Parameters:
        value - the city id value
        Throws:
        java.lang.IllegalArgumentException - on null or empty parameter
    • Method Detail

      • getValue

        public java.lang.String getValue()
        Getter
        Returns:
        city id value
      • length

        public int length()
        Getter
        Returns:
        city id length
      • toString

        public java.lang.String toString()
        Redefinition of toString
        Overrides:
        toString in class java.lang.Object
        Returns:
        the value of the city id
      • compareTo

        public int compareTo​(CityId other)
        Redefinition of compareTo
        Specified by:
        compareTo in interface java.lang.Comparable<CityId>
        Parameters:
        other - the CityId to compare to
        Returns:
        0 if other has the same value, 1 else
        Throws:
        java.lang.IllegalArgumentException - on null parameter
      • equals

        public boolean equals​(java.lang.Object other)
        Redefinition of equals
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - the cityId to compare to
        Returns:
        true if other has the same value, false else
        Throws:
        java.lang.IllegalArgumentException - on null or not CityId parameter
      • hashCode

        public int hashCode()
        Redefinition of hashCode
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashcode