Class DuplicateObjectException

    • Constructor Detail

      • DuplicateObjectException

        public DuplicateObjectException​(Object object)
        The constructor.
        Parameters:
        object - is the object that was rejected because it is a duplicate.
      • DuplicateObjectException

        public DuplicateObjectException​(Object object,
                                        Object key)
        The constructor.
        Parameters:
        object - is the object that was rejected because it is a duplicate.
        key - is the key the object could NOT be associated with because it already leads to another object.
      • DuplicateObjectException

        public DuplicateObjectException​(Object object,
                                        Object key,
                                        Object existing)
        The constructor.
        Parameters:
        object - is the object that was rejected because it is a duplicate.
        key - is the key the object could NOT be associated with because it already leads to another object.
        existing - is the object that is already registered for the given key.
        Since:
        3.0.0
    • Method Detail

      • put

        public static <KEY,​VALUE> void put​(Map<KEY,​VALUE> map,
                                                 KEY key,
                                                 VALUE value)
                                          throws DuplicateObjectException
        This method puts the given value into the given map using the given key.
        Type Parameters:
        KEY - is the generic type of the key.
        VALUE - is the generic type of the value.
        Parameters:
        map - is the Map.
        key - is the key.
        value - is the value to put.
        Throws:
        DuplicateObjectException - if the given map already contains a value for the given key that is NOT equal to the given value.
      • getCode

        public String getCode()
        Description copied from class: ApplicationException
        This method gets the code that identifies the detailed type of this object. While UUID is unique per instance of a ApplicationException this code is a short and readable identifier representing the ApplicationException Class. The default implementation returns the simple name. However, the code should remain stable after refactoring (so at least after the rename the previous code should be returned as String literal). This code may be used as a compact identifier to reference the related problem or information as well as for automatic tests of error situations that should remain stable even if the message text gets improved or the locale is unknown.
        Overrides:
        getCode in class ApplicationException
        Returns:
        the error code.