Class MetaParams
- java.lang.Object
-
- org.infinispan.functional.impl.MetaParams
-
@NotThreadSafe @Experimental public final class MetaParams extends Object implements Iterable<MetaParam<?>>
Represents aMetaParamcollection.In
Params, the internal array where each parameter was stored is indexed by an integer. This worked fine because the available parameters are exclusively controlled by the Infinispan. This is not the case withMetaParaminstances where users are expected to add their own types. So, forMetaParams, an array is still used but the lookup is done sequentially comparing the type of theMetaParamlooked for against the each individualMetaParaminstance stored inMetaParams.Having sequential
MetaParamlookups over an array is O(n), but this is not problematic since the number ofMetaParamto be stored with each cached entry is expected to be small, less than 10 perMetaParamscollection. So, the performance impact is quite small.Storing
MetaParaminstances in an array adds the least amount of overhead to keeping a collection ofMetaParamin memory along with each cached entry, while retaining flexibility to add or removeMetaParaminstances.This
MetaParamscollection is not thread safe because it is expected that any updates will be done having acquired write locks on the entireCacheEntrywhich references theMetaParamscollection. Hence, any updates could be done without the need to keepMetaParamsconcurrently safe. Also, although users can retrieve or update individualMetaParaminstances, they cannot act on the globally at theMetaParamslevel, and hence there is no risk of users misusingMetaParams. This class should not be accessible from user code, therefore it is package-protected.- Since:
- 8.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(MetaParam meta)voidaddMany(MetaParam... metaParams)MetaParamscopy()<T extends MetaParam>
Optional<T>find(Class<T> type)booleanisEmpty()Iterator<MetaParam<?>>iterator()static MetaParamsreadFrom(ObjectInput input)<T extends MetaParam>
voidremove(Class<T> type)<T extends MetaParam>
voidreplace(Class<T> type, Function<T,T> f)intsize()Spliterator<MetaParam<?>>spliterator()StringtoString()static voidwriteTo(ObjectOutput output, MetaParams params)
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
copy
public MetaParams copy()
-
add
public void add(MetaParam meta)
-
addMany
public void addMany(MetaParam... metaParams)
-
spliterator
public Spliterator<MetaParam<?>> spliterator()
- Specified by:
spliteratorin interfaceIterable<MetaParam<?>>
-
readFrom
public static MetaParams readFrom(ObjectInput input) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
writeTo
public static void writeTo(ObjectOutput output, MetaParams params) throws IOException
- Throws:
IOException
-
-