public abstract class Element
extends java.lang.Object
Elements allow to attach dynamic attributes based on a typed key, which are typically established
by a Processor. The decision whether to use a dynamic attribute or a plain getter/setter
which is hard-wired into the object model depends on whether the expressed information is
globally relevant for many processor or only used locally by a tool. For example, derived type
information is considered to be globally relevant and hard-wired into the object model, so it is
easy discoverable.
| Constructor and Description |
|---|
Element() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addAttribute(com.google.inject.Key<java.util.List<T>> key,
T value)
Adds an attribute value.
|
<T> T |
getAttribute(com.google.inject.Key<T> key)
Gets an attribute value.
|
<T> T |
getAttributeOrDefault(com.google.inject.Key<T> key,
T defaultValue)
Gets an attribute value if it exists, otherwise the given default value.
|
abstract java.lang.String |
getFullName()
Returns a fully qualified name for the element.
|
abstract Location |
getLocation()
Returns the location associated with this element.
|
abstract Model |
getModel()
Returns the model associated with this element.
|
abstract java.lang.String |
getSimpleName()
Returns a simple name for the element.
|
boolean |
hasAttribute(com.google.inject.Key<?> key)
Checks whether an attribute is present.
|
<T> T |
putAttribute(com.google.inject.Key<T> key,
T value)
Puts an attribute value, returning the old one.
|
<T> T |
removeAttribute(com.google.inject.Key<T> key)
Removes an attribute value, returning the old one.
|
public abstract Model getModel()
public abstract Location getLocation()
public abstract java.lang.String getFullName()
public abstract java.lang.String getSimpleName()
@Nullable
public <T> T putAttribute(com.google.inject.Key<T> key,
T value)
public <T> void addAttribute(com.google.inject.Key<java.util.List<T>> key,
T value)
@Nullable public <T> T removeAttribute(com.google.inject.Key<T> key)
public <T> T getAttribute(com.google.inject.Key<T> key)
public <T> T getAttributeOrDefault(com.google.inject.Key<T> key,
T defaultValue)
@Nullable public boolean hasAttribute(com.google.inject.Key<?> key)