Connection.setAttributeIfAbsent

Sets a user defined attribute without a value if the attribute with the specified key is not set yet. This is useful when you just want to put a 'mark' attribute. Its value is set to {@link bool#TRUE}. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); // might not always be bool.TRUE. } else { return setAttribute(key); } </pre>

@param key The key of the attribute we want to set @return The old value of the attribute. <tt>null</tt> if not found.

  1. Object setAttributeIfAbsent(string key, Object value)
  2. Object setAttributeIfAbsent(string key)
    interface Connection
    Object
    setAttributeIfAbsent
    (
    string key
    )

Meta