Search in sources :

Example 1 with LazyMapEntry

use of com.hazelcast.map.impl.LazyMapEntry in project hazelcast by hazelcast.

the class ClientMapProxy method entrySet.

@Override
public Set<Entry<K, V>> entrySet() {
    ClientMessage request = MapEntrySetCodec.encodeRequest(name);
    ClientMessage response = invoke(request);
    MapEntrySetCodec.ResponseParameters resultParameters = MapEntrySetCodec.decodeResponse(response);
    InflatableSet.Builder<Entry<K, V>> setBuilder = InflatableSet.newBuilder(resultParameters.response.size());
    InternalSerializationService serializationService = ((InternalSerializationService) getContext().getSerializationService());
    for (Entry<Data, Data> row : resultParameters.response) {
        LazyMapEntry entry = new LazyMapEntry(row.getKey(), row.getValue(), serializationService);
        setBuilder.add(entry);
    }
    return setBuilder.build();
}
Also used : InflatableSet(com.hazelcast.util.collection.InflatableSet) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) MapEntrySetCodec(com.hazelcast.client.impl.protocol.codec.MapEntrySetCodec) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Example 2 with LazyMapEntry

use of com.hazelcast.map.impl.LazyMapEntry in project hazelcast by hazelcast.

the class ClientMapProxy method entrySet.

@Override
@SuppressWarnings("unchecked")
public Set<Entry<K, V>> entrySet(Predicate predicate) {
    if (predicate instanceof PagingPredicate) {
        return entrySetWithPagingPredicate((PagingPredicate) predicate);
    }
    ClientMessage request = MapEntriesWithPredicateCodec.encodeRequest(name, toData(predicate));
    ClientMessage response = invoke(request);
    MapEntriesWithPredicateCodec.ResponseParameters resultParameters = MapEntriesWithPredicateCodec.decodeResponse(response);
    InflatableSet.Builder<Entry<K, V>> setBuilder = InflatableSet.newBuilder(resultParameters.response.size());
    InternalSerializationService serializationService = ((InternalSerializationService) getContext().getSerializationService());
    for (Entry<Data, Data> row : resultParameters.response) {
        LazyMapEntry entry = new LazyMapEntry(row.getKey(), row.getValue(), serializationService);
        setBuilder.add(entry);
    }
    return setBuilder.build();
}
Also used : InflatableSet(com.hazelcast.util.collection.InflatableSet) PagingPredicate(com.hazelcast.query.PagingPredicate) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) MapEntriesWithPredicateCodec(com.hazelcast.client.impl.protocol.codec.MapEntriesWithPredicateCodec) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Example 3 with LazyMapEntry

use of com.hazelcast.map.impl.LazyMapEntry in project hazelcast by hazelcast.

the class AbstractMapPartitionIterator method next.

public Map.Entry<K, V> next() {
    while (hasNext()) {
        currentIndex = index;
        index++;
        final Data keyData = getKey(currentIndex);
        final Object value = getValue(currentIndex, keyData);
        if (value != null) {
            return new LazyMapEntry(keyData, value, (InternalSerializationService) getSerializationService());
        }
    }
    throw new NoSuchElementException();
}
Also used : LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) Data(com.hazelcast.nio.serialization.Data) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

LazyMapEntry (com.hazelcast.map.impl.LazyMapEntry)3 Data (com.hazelcast.nio.serialization.Data)3 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)2 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)2 InflatableSet (com.hazelcast.util.collection.InflatableSet)2 MapEntriesWithPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapEntriesWithPredicateCodec)1 MapEntrySetCodec (com.hazelcast.client.impl.protocol.codec.MapEntrySetCodec)1 PagingPredicate (com.hazelcast.query.PagingPredicate)1 NoSuchElementException (java.util.NoSuchElementException)1