org.springframework.core

Interface AttributeAccessor

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      java.lang.String[] attributeNames()
      Return the names of all attributes.
      java.lang.Object getAttribute(java.lang.String name)
      Get the value of the attribute identified by name.
      boolean hasAttribute(java.lang.String name)
      Return true if the attribute identified by name exists.
      java.lang.Object removeAttribute(java.lang.String name)
      Remove the attribute identified by name and return its value.
      void setAttribute(java.lang.String name, java.lang.Object value)
      Set the attribute defined by name to the supplied value.
    • Method Detail

      • setAttribute

        void setAttribute(java.lang.String name,
                          @Nullable
                          java.lang.Object value)
        Set the attribute defined by name to the supplied value. If value is null, the attribute is removed.

        In general, users should take care to prevent overlaps with other metadata attributes by using fully-qualified names, perhaps using class or package names as prefix.

        Parameters:
        name - the unique attribute key
        value - the attribute value to be attached
      • getAttribute

        @Nullable
        java.lang.Object getAttribute(java.lang.String name)
        Get the value of the attribute identified by name. Return null if the attribute doesn't exist.
        Parameters:
        name - the unique attribute key
        Returns:
        the current value of the attribute, if any
      • removeAttribute

        @Nullable
        java.lang.Object removeAttribute(java.lang.String name)
        Remove the attribute identified by name and return its value. Return null if no attribute under name is found.
        Parameters:
        name - the unique attribute key
        Returns:
        the last value of the attribute, if any
      • hasAttribute

        boolean hasAttribute(java.lang.String name)
        Return true if the attribute identified by name exists. Otherwise return false.
        Parameters:
        name - the unique attribute key
      • attributeNames

        java.lang.String[] attributeNames()
        Return the names of all attributes.