@@ -0,0 +1,6 @@ | |||
public class AnAttributedClass implements Attributable { | |||
public void doSomething() { | |||
this.setAttribute("foo", "bar"); | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
import java.util.*; | |||
public interface Attributable { | |||
void setAttribute(String name, Object attribute); | |||
Object getAttribute(String name); | |||
static aspect DefImpl { | |||
private Map<String,Object> Attributable.attributes = | |||
new HashMap<String,Object>(); | |||
public void Attributable.setAttribute(String name, Object attribute) { | |||
this.attributes.put(name, attribute); | |||
} | |||
public Object Attributable.getAttribute(String name) { | |||
return this.attributes.get(name); | |||
} | |||
} | |||
} |