Search in sources :

Example 1 with RestValue

use of com.hazelcast.internal.ascii.rest.RestValue in project hazelcast by hazelcast.

the class TextProtocolsDataSerializerHook method createFactory.

@Override
public DataSerializableFactory createFactory() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
    constructors[MEMCACHE_ENTRY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemcacheEntry();
        }
    };
    constructors[REST_VALUE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RestValue();
        }
    };
    return new ArrayDataSerializableFactory(constructors);
}
Also used : IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) RestValue(com.hazelcast.internal.ascii.rest.RestValue) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) MemcacheEntry(com.hazelcast.internal.ascii.memcache.MemcacheEntry)

Example 2 with RestValue

use of com.hazelcast.internal.ascii.rest.RestValue in project hazelcast by hazelcast.

the class TextCommandServiceImpl method getByteArray.

@Override
public byte[] getByteArray(String mapName, String key) {
    Object value = hazelcast.getMap(mapName).get(key);
    byte[] result = null;
    if (value != null) {
        if (value instanceof RestValue) {
            RestValue restValue = (RestValue) value;
            result = restValue.getValue();
        } else if (value instanceof byte[]) {
            result = (byte[]) value;
        } else {
            result = toByteArray(value);
        }
    }
    return result;
}
Also used : RestValue(com.hazelcast.internal.ascii.rest.RestValue)

Aggregations

RestValue (com.hazelcast.internal.ascii.rest.RestValue)2 MemcacheEntry (com.hazelcast.internal.ascii.memcache.MemcacheEntry)1 ArrayDataSerializableFactory (com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)1 ConstructorFunction (com.hazelcast.internal.util.ConstructorFunction)1 IdentifiedDataSerializable (com.hazelcast.nio.serialization.IdentifiedDataSerializable)1