public interface IContext
Property
or Class
.
Context implementations may use an identity-based lookup, name-based lookup, or anything in-between. For portability, keys need to be unique instances with unique names.
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Class<?> clazz)
Returns whether this context has a value associated with the given class.
|
boolean |
containsKey(Property<?> property)
Returns whether this context has a value associated with the given
property.
|
<T> T |
get(java.lang.Class<T> clazz)
Returns the context value associated with the given class.
|
<T> T |
get(Property<T> property)
Returns the context value associated with the given property.
|
default <T> T |
getOrDefault(Property<T> property)
Returns the context value associated with the given property;
if no value is associated with the given property, returns
the default value of the property.
|
<T> T get(Property<T> property)
property
- the property being queried (not null
)null
default <T> T getOrDefault(Property<T> property)
This implementation makes no guarantees about synchronization or atomicity.
property
- the property being queried (not null
)null
)Property.defaultValue()
<T> T get(java.lang.Class<T> clazz)
clazz
- the class being queried (not null
)null
boolean containsKey(Property<?> property)
property
- the property being queried (not null
)true
if this context has a value
for the given property, and false
otherwiseboolean containsKey(java.lang.Class<?> clazz)
clazz
- the class being queried (not null
)true
if this context has a value
for the given class, and false
otherwiseCopyright (c) 2014, 2019 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0