/*
(non-Javadoc)

@see
com.ibm.websphere.servlet.session.IBMApplicationSession#setAttribute(java
.lang.String, java.lang.Object)
778673
public void setAttribute(String name, Object attribute) {
        if (!_iSess.isValid())
            throw new IllegalStateException();
        if (null != attribute) {
            if (!(attribute instanceof HttpSessionBindingListener)) {
                _iSess.setAttribute(name, attribute, Boolean.FALSE);
            } else {
                _iSess.setAttribute(name, attribute, Boolean.TRUE);
            }
        } else {
            // attribute is null
            // if name is not null, remove it ... otherwise do nothing
            if (name != null) {
                _iSess.removeAttribute(name);
            }
        }
    }
307063
@Override
    public void setAttribute(String key, Object value) {
        if (value == null) {
            setAttribute(key, null);
        } else {
            setAttribute(key, Collections.singletonList(value));
        }
    }
781737
public void setSessionAttributes(Map<String, Object> attributes)
    {
        this.sessionAttributes.putAll(attributes);
        propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
    }
1217846
@Override
	public void setAttribute(final String key, final Object value) {
		logger.debug("Attribute ({}) is set to ({})", key, value);
		JKThreadLocal.setValue(key, value);
	}
848475
public void setAttribute(String attributeName, Object value) {
        synchronized (_iSession) {
            if (!_iSession.isValid())
                throw new IllegalStateException();
            if (null != value) {
                if (!(value instanceof HttpSessionBindingListener)) {
                    _iSession.setAttribute(attributeName, value, Boolean.FALSE);
                } else {
                    _iSession.setAttribute(attributeName, value, Boolean.TRUE);
                }
            }
        }
    }
131719
void setAttribute(File file, String attribute, Object value) {
    state.checkOpen();
    // TODO(cgdecker): Change attribute stuff to avoid the sad boolean parameter
    attributes.setAttribute(file, attribute, value, false);
  }
1350139
public void setAttribute(String pName, Object pValue) {
        crossoverCheck("setAttribute");
        if (pName != null && pValue == null)
            removeAttribute(pName);
        else
            putSessionValue(pName, pValue, false);
    }
995207
public void setAttributes(java.util.Collection<TargetGroupAttribute> attributes) {
        if (attributes == null) {
            this.attributes = null;
            return;
        }

        this.attributes = new java.util.ArrayList<TargetGroupAttribute>(attributes);
    }
98628
public void setAttributes(java.util.Collection<FacetAttribute> attributes) {
        if (attributes == null) {
            this.attributes = null;
            return;
        }

        this.attributes = new java.util.ArrayList<FacetAttribute>(attributes);
    }
635604
public void setAttribute(Object key, Object value) {
		if (attributes == null) {
			attributes = new HashMap(5);
		}
		attributes.put(key, value);
	}
1044933
public void setAttr(String attr, Object val) throws NamingException {
    getAttributes().put(attr, val);
  }
304048
public void set(String name, Object obj) throws IOException {
        if (!(obj instanceof Boolean))
            throw new IOException("Attribute must be of type Boolean.");

        boolean val = ((Boolean)obj).booleanValue();
        set(getPosition(name), val);
        encodeThis();
    }
1161042
@SuppressWarnings({ "rawtypes", "unchecked" })
	private void setAttribute(NodeConfig nodeConfig, Object targetObject) throws UnmarshalException {
		Class targetClass = targetObject.getClass();
		List attributes = nodeConfig.getAttribute();
		if (attributes != null && attributes.size() > 0) {
			for (Iterator iterAttr = attributes.iterator(); iterAttr.hasNext();) {
				AttributeConfig attribute = (AttributeConfig) iterAttr.next();
				String methodName = Constant.SET_PREFIX + StringUtils.capitalize(attribute.getName());
				try {
					Method method = targetClass.getMethod(methodName, String.class);
					if (method != null) {
						setMethod(method, targetObject, attribute.getValue());
					}
				} catch (NoSuchMethodException e) {
					if (validation) {
						throw new UnmarshalException(e);
					}
				}
			}
		}
	}
304401
public void setAttribute(String key, Object attribute) {

		if (!isValid())
			throw new IllegalStateException(
					"Can not bind object to session that has been invalidated!!");

		if (key == null)
			throw new NullPointerException(
					"Name of attribute to bind cant be null!!!");
		if (attribute == null)
			throw new NullPointerException(
					"Attribute that is to be bound cant be null!!!");

		// Construct an event with the new value
		SipApplicationSessionBindingEvent event = null;

        // Call the valueBound() method if necessary
        if (attribute instanceof SipApplicationSessionBindingListener) {
            // Don't call any notification if replacing with the same value
            Object oldValue = getAttributeMap().get(key);
            if (attribute != oldValue) {
            	event = new SipApplicationSessionBindingEvent(this, key);
                try {
                    ((SipApplicationSessionBindingListener) attribute).valueBound(event);
                } catch (Throwable t){
                	logger.error("SipSessionBindingListener threw exception", t);
                }
            }
        }

		Object previousValue = this.getAttributeMap().put(key, attribute);

		if (previousValue != null && previousValue != attribute &&
	            previousValue instanceof SipApplicationSessionBindingListener) {
            try {
                ((SipApplicationSessionBindingListener) previousValue).valueUnbound
                    (new SipApplicationSessionBindingEvent(this, key));
            } catch (Throwable t) {
            	logger.error("SipSessionBindingListener threw exception", t);
            }
        }

		SipListeners listeners = sipContext.getListeners();
		List<SipApplicationSessionAttributeListener> listenersList = listeners.getSipApplicationSessionAttributeListeners();
		if(listenersList.size() > 0) {
			if(event == null) {
				event = new SipApplicationSessionBindingEvent(this, key);
			}
			if (previousValue == null) {
				for (SipApplicationSessionAttributeListener listener : listenersList) {
					if(logger.isDebugEnabled()) {
						logger.debug("notifying SipApplicationSessionAttributeListener " + listener.getClass().getCanonicalName() + " of attribute added on key "+ key);
					}
					try {
						listener.attributeAdded(event);
					} catch (Throwable t) {
						logger.error("SipApplicationSessionAttributeListener threw exception", t);
					}
				}
			} else {
				for (SipApplicationSessionAttributeListener listener : listenersList) {
					if(logger.isDebugEnabled()) {
						logger.debug("notifying SipApplicationSessionAttributeListener " + listener.getClass().getCanonicalName() + " of attribute replaced on key "+ key);
					}
					try {
						listener.attributeReplaced(event);
					} catch (Throwable t) {
						logger.error("SipApplicationSessionAttributeListener threw exception", t);
					}
				}
			}
		}
	}
118996
def setAttribute(self, attr: str, value: _AttrValueType) -> None:
        """"""
        self._set_attribute(attr, value)
234139
public void setAttr(String attr) {
		String[] list = attr.split(";");
		for (int i = 0; i < list.length; ++i) {
			String[] val = list[i].split("=");
			if (val.length != 2)
				return ;
			getElement().setAttribute(val[0].trim(), val[1].trim());
		}
	}
872496
public void setAttributes( final String... attributes )
    {
        this.attributes = attributes == null ? null : new HashSet<String>( Arrays.asList( attributes ) );
    }