/*
 * Copyright 2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package leap.lang.accessor;

/**
 * Interface defining a generic contract for attaching and accessing metadata to/from arbitrary objects.
 */
public interface AttributeAccessor extends AttributeGetter,AttributeSetter {

	void removeAttribute(String name);
	
}
@@ -638,16 +638,53 @@
 essor;%0A%0A
+import java.util.function.Supplier;%0A%0A
 /**%0A * I
@@ -869,44 +869,793 @@
 r %7B%0A
-%0A%09void removeAttribute(String name);%0A%09
+%09Object NULL = new Object();%0A%0A%09/**%0A%09 * Removes the attribute.%0A%09 */%0A%09void removeAttribute(String name);%0A%0A%09/**%0A%09 * Returns the exists attribute value or set the value if not exists.%0A%09 */%0A%09default %3CT%3E T getSetAttribute(String name, Supplier%3CT%3E supplier) %7B%0A%09%09T value = (T)getAttribute(name);%0A%09%09if(null == value) %7B%0A%09%09%09value = supplier.get();%0A%09%09%09if(null != value) %7B%0A%09%09%09%09setAttribute(name, value);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return value;%0A%09%7D%0A%0A%09/**%0A%09 * Returns the exists attribute value or set the value if not exists.%0A%09 */%0A%09default %3CT%3E T getSetNullAttribute(String name, Supplier%3CT%3E supplier) %7B%0A%09%09Object value = (T)getAttribute(name);%0A%09%09if(null == value) %7B%0A%09%09%09value = supplier.get();%0A%09%09%09if(null != value) %7B%0A%09%09%09%09value = NULL;%0A%09%09%09%09setAttribute(name, value);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return value == NULL ? null : (T)value;%0A%09%7D
 %0A%7D

add AttributeAccessor#getSetAttribute*