/** Returns the scope, or null if it is not associated with a scope. * <p>Notice that, prior to 5.0.8, "component" is returned if * it is not associated with a scope (which is not correct since * this info might be associated with a page). * @since 3.0.6 */ public String getScope() { return _scope != -1 ? Components.scopeToString(_scope) : null; }
public Object setAttribute(String name, Object value, int scope) { if (value == null && Boolean.parseBoolean(Library.getProperty(AUTO_REMOVE_NULL))) { // null value + old method = remove attribute return removeAttribute(name, scope); } // either 1. null value + new method or 2. non null value + old/new method final Map<String, Object> attrs = getAttributes(scope); if (attrs == Collections.EMPTY_MAP) throw new IllegalStateException("This component, " + this + ", doesn't belong to the " + Components.scopeToString(scope) + " scope"); return attrs.put(name, value); }