Package com.exedio.cope.pattern
Class MapField<K,V>
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.Pattern
-
- com.exedio.cope.pattern.MapField<K,V>
-
- All Implemented Interfaces:
MapFieldInterface<K,V>
,Serializable
public final class MapField<K,V> extends Pattern implements MapFieldInterface<K,V>
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MapField<K,V>
copyKeyWith(FunctionField<?> copyWith)
MapField<K,V>
copyValueWith(FunctionField<?> copyWith)
static <K,V>
MapField<K,V>create(FunctionField<K> key, FunctionField<V> value)
V
get(Item item, K key)
Returns value associated with given key for item.V
getAndCast(Item item, Object key)
FunctionField<K>
getKey()
Class<K>
getKeyClass()
Returns the Key Class of this.Map<K,V>
getMap(Item item)
Returns the map for given item.ItemField<?>
getParent()
<P extends Item>
ItemField<P>getParent(Class<P> parentClass)
Type<?>
getRelationType()
UniqueConstraint
getUniqueConstraint()
FunctionField<V>
getValue()
Class<V>
getValueClass()
Returns the Value Class of this.Join
join(Query<?> q, K key)
static <K,V>
MapField<K,V>newMap(FunctionField<K> key, FunctionField<V> value)
Deprecated.Usecreate(FunctionField,FunctionField)
insteadprotected void
onMount()
Here you can do additional initialization not yet done in the constructor.void
set(Item item, K key, V value)
Sets value associated with given key for item.void
setAndCast(Item item, Object key, Object value)
void
setMap(Item item, Map<? extends K,? extends V> map)
Sets the map for given item.-
Methods inherited from class com.exedio.cope.Pattern
addSource, addSource, addSource, addSource, addSourceFeature, addSourceFeature, addSourceFeature, annotationField, equals, getGeneratedTypes, getSourceFeatures, getSourceFeaturesGather, getSourceFields, getSources, getSourceTypes, getType, hashCode, initialize, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newType, newType, registerSource
-
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
-
-
-
Method Detail
-
create
public static <K,V> MapField<K,V> create(FunctionField<K> key, FunctionField<V> value)
-
copyKeyWith
public MapField<K,V> copyKeyWith(FunctionField<?> copyWith)
-
copyValueWith
public MapField<K,V> copyValueWith(FunctionField<?> copyWith)
-
onMount
protected void onMount()
Description copied from class:Pattern
Here you can do additional initialization not yet done in the constructor. In this method you can call methodsPattern.getType()
andFeature.getName()
for the first time.
-
getParent
public ItemField<?> getParent()
-
getKeyClass
public Class<K> getKeyClass()
Description copied from interface:MapFieldInterface
Returns the Key Class of this.- Specified by:
getKeyClass
in interfaceMapFieldInterface<K,V>
-
getKey
public FunctionField<K> getKey()
-
getUniqueConstraint
public UniqueConstraint getUniqueConstraint()
-
getValueClass
public Class<V> getValueClass()
Description copied from interface:MapFieldInterface
Returns the Value Class of this.- Specified by:
getValueClass
in interfaceMapFieldInterface<K,V>
-
getValue
public FunctionField<V> getValue()
-
getRelationType
public Type<?> getRelationType()
-
get
@Nullable public V get(@Nonnull Item item, @Nonnull K key)
Description copied from interface:MapFieldInterface
Returns value associated with given key for item.- Specified by:
get
in interfaceMapFieldInterface<K,V>
-
set
public void set(@Nonnull Item item, @Nonnull K key, @Nullable V value)
Description copied from interface:MapFieldInterface
Sets value associated with given key for item.- Specified by:
set
in interfaceMapFieldInterface<K,V>
-
getMap
@Nonnull public Map<K,V> getMap(Item item)
Description copied from interface:MapFieldInterface
Returns the map for given item.- Specified by:
getMap
in interfaceMapFieldInterface<K,V>
-
setMap
public void setMap(@Nonnull Item item, @Nonnull Map<? extends K,? extends V> map)
Description copied from interface:MapFieldInterface
Sets the map for given item.- Specified by:
setMap
in interfaceMapFieldInterface<K,V>
-
newMap
@Deprecated public static <K,V> MapField<K,V> newMap(FunctionField<K> key, FunctionField<V> value)
Deprecated.Usecreate(FunctionField,FunctionField)
instead
-
-