Search in sources :

Example 21 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientListProxy method subList.

@Override
public List<E> subList(int fromIndex, int toIndex) {
    ClientMessage request = ListSubCodec.encodeRequest(name, fromIndex, toIndex);
    ClientMessage response = invokeOnPartition(request);
    ListSubCodec.ResponseParameters resultParameters = ListSubCodec.decodeResponse(response);
    List<Data> resultCollection = resultParameters.response;
    SerializationService serializationService = getContext().getSerializationService();
    return new UnmodifiableLazyList<E>(resultCollection, serializationService);
}
Also used : ListSubCodec(com.hazelcast.client.impl.protocol.codec.ListSubCodec) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 22 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientMapProxy method project.

@Override
public <R> Collection<R> project(Projection<Entry<K, V>, R> projection, Predicate<K, V> predicate) {
    ClientMessage request = MapProjectWithPredicateCodec.encodeRequest(name, toData(projection), toData(predicate));
    ClientMessage response = invoke(request);
    MapProjectWithPredicateCodec.ResponseParameters resultParameters = MapProjectWithPredicateCodec.decodeResponse(response);
    return new UnmodifiableLazyList<R>(resultParameters.response, getSerializationService());
}
Also used : MapProjectWithPredicateCodec(com.hazelcast.client.impl.protocol.codec.MapProjectWithPredicateCodec) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 23 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientMapProxy method project.

@Override
public <R> Collection<R> project(@Nonnull Projection<? super Entry<K, V>, R> projection, @Nonnull Predicate<K, V> predicate) {
    checkNotNull(projection, NULL_PROJECTION_IS_NOT_ALLOWED);
    checkNotNull(predicate, NULL_PREDICATE_IS_NOT_ALLOWED);
    checkNotPagingPredicate(predicate, "project");
    ClientMessage request = MapProjectWithPredicateCodec.encodeRequest(name, toData(projection), toData(predicate));
    ClientMessage response = invokeWithPredicate(request, predicate);
    return new UnmodifiableLazyList(MapProjectWithPredicateCodec.decodeResponse(response), getSerializationService());
}
Also used : UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 24 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientMapProxy method values.

@Override
public Collection<V> values(@Nonnull Predicate predicate) {
    checkNotNull(predicate, NULL_PREDICATE_IS_NOT_ALLOWED);
    if (containsPagingPredicate(predicate)) {
        return valuesForPagingPredicate(predicate);
    }
    ClientMessage request = MapValuesWithPredicateCodec.encodeRequest(name, toData(predicate));
    ClientMessage response = invokeWithPredicate(request, predicate);
    List<Data> dataList = MapValuesWithPredicateCodec.decodeResponse(response);
    return (Collection<V>) new UnmodifiableLazyList(dataList, getSerializationService());
}
Also used : Collection(java.util.Collection) CollectionUtil.objectToDataCollection(com.hazelcast.internal.util.CollectionUtil.objectToDataCollection) Data(com.hazelcast.internal.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 25 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientListProxy method iterator.

@Override
public Iterator<E> iterator() {
    ClientMessage request = ListIteratorCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request);
    List<Data> resultCollection = ListIteratorCodec.decodeResponse(response);
    return (Iterator<E>) new UnmodifiableLazyList(resultCollection, getSerializationService()).iterator();
}
Also used : ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) Data(com.hazelcast.internal.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Aggregations

UnmodifiableLazyList (com.hazelcast.spi.impl.UnmodifiableLazyList)34 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)30 Data (com.hazelcast.internal.serialization.Data)9 Data (com.hazelcast.nio.serialization.Data)6 Nonnull (javax.annotation.Nonnull)4 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 ArrayList (java.util.ArrayList)3 CollectionUtil.objectToDataCollection (com.hazelcast.internal.util.CollectionUtil.objectToDataCollection)2 SerializableList (com.hazelcast.spi.impl.SerializableList)2 SerializationService (com.hazelcast.spi.serialization.SerializationService)2 Collection (java.util.Collection)2 List (java.util.List)2 ListIterator (java.util.ListIterator)2 ListGetAllCodec (com.hazelcast.client.impl.protocol.codec.ListGetAllCodec)1 ListSubCodec (com.hazelcast.client.impl.protocol.codec.ListSubCodec)1 MapProjectCodec (com.hazelcast.client.impl.protocol.codec.MapProjectCodec)1 MapProjectWithPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapProjectWithPredicateCodec)1 MapValuesCodec (com.hazelcast.client.impl.protocol.codec.MapValuesCodec)1 MapValuesWithPagingPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapValuesWithPagingPredicateCodec)1 MapValuesWithPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapValuesWithPredicateCodec)1