|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.lang.protocol.Mappings
public final class Mappings
Utility methods related to Mapping.
| Method Summary | ||
|---|---|---|
static
|
augment(Mapping<K,V> in,
java.lang.Object... keysAndValues)
Equivalent with union(Mapping, Mapping), where the first argument is in and the second is
constructed from the given keyValuePairs. |
|
static
|
fromMap(java.util.Map<K,V> map)
Returns a proxy Mapping for a Map. |
|
static
|
get(Mapping<? extends K,?> mapping,
java.lang.Object key,
java.lang.Class<T> targetType)
Invokes Mapping.get(Object) on the mapping and, if the result is not null, converts it
to the given targetType. |
|
static
|
getNonNull(Mapping<K,?> mapping,
java.lang.String key,
java.lang.Class<T> targetType)
|
|
static
|
mapping(java.lang.Object... keysAndValues)
|
|
static
|
none()
|
|
static
|
override(Mapping<K,V> in,
java.lang.Object... keysAndValues)
Equivalent with union(Mapping, Mapping), where the first argument is constructed from the given keyValuePairs and the second argument is in. |
|
static Mapping<java.lang.String,java.lang.Object> |
propertiesOf(java.lang.Object subject)
Returns a mapping of property names to property values for the given subject object. |
|
static
|
union(Mapping<K,V> op1,
Mapping<K,V> op2)
Returns a mapping that implements the "union" of two mappings. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <K,V> Mapping<K,V> fromMap(java.util.Map<K,V> map)
Mapping for a Map. This is very straightforward because the Map declares
all methods that the Mapping requires. (Actually the Map should extend Mapping,
but doesn't.)
public static <K,V> Mapping<K,V> mapping(java.lang.Object... keysAndValues)
keysAndValues - An alternating sequence of keys and values; even elements must have type K, odd
elements must have type V
public static <K,V> Mapping<K,V> none()
Mapping with no mappingspublic static Mapping<java.lang.String,java.lang.Object> propertiesOf(java.lang.Object subject)
subject object.
The existence of a property "propertyName" is determined by the existence of one of the
following, in this order:
getPropertyName()"
isPropertyName()"
hasPropertyName()"
propertyName()"
propertyName"
@Nullable
public static <K,T> T get(Mapping<? extends K,?> mapping,
java.lang.Object key,
java.lang.Class<T> targetType)
Mapping.get(Object) on the mapping and, if the result is not null, converts it
to the given targetType.
java.lang.IllegalArgumentException - The type of the value of the property is not assignable to T
public static <K,T> T getNonNull(Mapping<K,?> mapping,
java.lang.String key,
java.lang.Class<T> targetType)
mapping maps the key
java.lang.IllegalArgumentException - The mapping does not contain the given key
java.lang.IllegalArgumentException - The mapping contains the key, but the mapped value is null
java.lang.IllegalArgumentException - The mapping contains the key, but the mapped value is not
assignable to T
public static <K,V> Mapping<K,V> union(Mapping<K,V> op1,
Mapping<K,V> op2)
For the returned Mapping, the following conditions apply:
null iff none of the operands contain the key.
public static <K,V> Mapping<K,V> augment(Mapping<K,V> in,
java.lang.Object... keysAndValues)
union(Mapping, Mapping), where the first argument is in and the second is
constructed from the given keyValuePairs.
keysAndValues - An alternating sequence of keys and values; even elements must have type K, odd
elements must have type V
public static <K,V> Mapping<K,V> override(Mapping<K,V> in,
java.lang.Object... keysAndValues)
union(Mapping, Mapping), where the first argument is constructed from the given keyValuePairs and the second argument is in.
keysAndValues - An alternating sequence of keys and values; even elements must have type K, odd
elements must have type V
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||