当前位置: 首页>>代码示例>>Java>>正文


Java MarshalException.getMessage方法代码示例

本文整理汇总了Java中org.apache.cassandra.serializers.MarshalException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MarshalException.getMessage方法的具体用法?Java MarshalException.getMessage怎么用?Java MarshalException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.serializers.MarshalException的用法示例。


在下文中一共展示了MarshalException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, SetType type, ProtocolVersion version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Set<?> s = type.getSerializer().deserializeForNativeProtocol(value, version);
        SortedSet<ByteBuffer> elements = new TreeSet<>(type.getElementsType());
        for (Object element : s)
            elements.add(type.getElementsType().decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:Sets.java

示例2: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, ListType type, ProtocolVersion version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        List<?> l = type.getSerializer().deserializeForNativeProtocol(value, version);
        List<ByteBuffer> elements = new ArrayList<>(l.size());
        for (Object element : l)
            // elements can be null in lists that represent a set of IN values
            elements.add(element == null ? null : type.getElementsType().decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:Lists.java

示例3: parsedValue

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
private ByteBuffer parsedValue(AbstractType<?> validator) throws InvalidRequestException
{
    if (validator instanceof ReversedType<?>)
        validator = ((ReversedType<?>) validator).baseType;
    try
    {
        if (type == Type.HEX)
            // Note that validator could be BytesType, but it could also be a custom type, so
            // we hardcode BytesType (rather than using 'validator') in the call below.
            // Further note that BytesType doesn't want it's input prefixed by '0x', hence the substring.
            return BytesType.instance.fromString(text.substring(2));

        if (validator instanceof CounterColumnType)
            return LongType.instance.fromString(text);
        return validator.fromString(text);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:22,代码来源:Constants.java

示例4: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, MapType type, ProtocolVersion version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version);
        Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size());
        for (Map.Entry<?, ?> entry : m.entrySet())
            map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue()));
        return new Value(map);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:Maps.java

示例5: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, SetType type, int version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Set<?> s = (Set<?>)type.getSerializer().deserializeForNativeProtocol(value, version);
        SortedSet<ByteBuffer> elements = new TreeSet<ByteBuffer>(type.getElementsType());
        for (Object element : s)
            elements.add(type.getElementsType().decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:Sets.java

示例6: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, ListType type, int version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        List<?> l = (List<?>)type.getSerializer().deserializeForNativeProtocol(value, version);
        List<ByteBuffer> elements = new ArrayList<ByteBuffer>(l.size());
        for (Object element : l)
            // elements can be null in lists that represent a set of IN values
            elements.add(element == null ? null : type.getElementsType().decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:Lists.java

示例7: parsedValue

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
private ByteBuffer parsedValue(AbstractType<?> validator) throws InvalidRequestException
{
    if (validator instanceof ReversedType<?>)
        validator = ((ReversedType<?>) validator).baseType;
    try
    {
        // BytesType doesn't want it's input prefixed by '0x'.
        if (type == Type.HEX && validator instanceof BytesType)
            return validator.fromString(text.substring(2));
        if (validator instanceof CounterColumnType)
            return LongType.instance.fromString(text);
        return validator.fromString(text);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:Constants.java

示例8: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, MapType type, int version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Map<?, ?> m = (Map<?, ?>)type.getSerializer().deserializeForNativeProtocol(value, version);
        Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<ByteBuffer, ByteBuffer>(m.size());
        for (Map.Entry<?, ?> entry : m.entrySet())
            map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue()));
        return new Value(map);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:Maps.java

示例9: getByteBuffer

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
/**
 * Returns the typed value, serialized to a ByteBuffer according to a
 * comparator/validator.
 *
 * @return a ByteBuffer of the value.
 * @throws InvalidRequestException if unable to coerce the string to its type.
 */
public ByteBuffer getByteBuffer(AbstractType<?> validator, List<ByteBuffer> variables) throws InvalidRequestException
{
    try
    {
        if (!isBindMarker()) return validator.fromStringCQL2(text);

        // must be a marker term so check for a CqlBindValue stored in the term
        if (bindIndex == null)
            throw new AssertionError("a marker Term was encountered with no index value");

        return variables.get(bindIndex);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:Term.java

示例10: validateKey

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static void validateKey(CFMetaData metadata, ByteBuffer key) throws org.apache.cassandra.exceptions.InvalidRequestException
{
    if (key == null || key.remaining() == 0)
    {
        throw new org.apache.cassandra.exceptions.InvalidRequestException("Key may not be empty");
    }

    // check that key can be handled by FBUtilities.writeShortByteArray
    if (key.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
    {
        throw new org.apache.cassandra.exceptions.InvalidRequestException("Key length of " + key.remaining() +
                                                                          " is longer than maximum of " +
                                                                          FBUtilities.MAX_UNSIGNED_SHORT);
    }

    try
    {
        metadata.getKeyValidator().validate(key);
    }
    catch (MarshalException e)
    {
        throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:ThriftValidation.java

示例11: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, MapType type, int version) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version);
        Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size());
        for (Map.Entry<?, ?> entry : m.entrySet())
            map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue()));
        return new Value(map);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:18,代码来源:Maps.java

示例12: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, SetType type) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Set<?> s = (Set<?>)type.compose(value);
        Set<ByteBuffer> elements = new LinkedHashSet<ByteBuffer>(s.size());
        for (Object element : s)
            elements.add(type.elements.decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:Sets.java

示例13: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, ListType type) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        List<?> l = (List<?>)type.compose(value);
        List<ByteBuffer> elements = new ArrayList<ByteBuffer>(l.size());
        for (Object element : l)
            elements.add(type.elements.decompose(element));
        return new Value(elements);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:Lists.java

示例14: fromSerialized

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static Value fromSerialized(ByteBuffer value, MapType type) throws InvalidRequestException
{
    try
    {
        // Collections have this small hack that validate cannot be called on a serialized object,
        // but compose does the validation (so we're fine).
        Map<?, ?> m = (Map<?, ?>)type.compose(value);
        Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<ByteBuffer, ByteBuffer>(m.size());
        for (Map.Entry<?, ?> entry : m.entrySet())
            map.put(type.keys.decompose(entry.getKey()), type.values.decompose(entry.getValue()));
        return new Value(map);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:Maps.java

示例15: validateRange

import org.apache.cassandra.serializers.MarshalException; //导入方法依赖的package包/类
public static void validateRange(CFMetaData metadata, ColumnParent column_parent, SliceRange range) throws org.apache.cassandra.exceptions.InvalidRequestException
{
    AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, column_parent.super_column);
    try
    {
        comparator.validate(range.start);
        comparator.validate(range.finish);
    }
    catch (MarshalException e)
    {
        throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
    }

    if (range.count < 0)
        throw new org.apache.cassandra.exceptions.InvalidRequestException("get_slice requires non-negative count");

    Comparator<ByteBuffer> orderedComparator = range.isReversed() ? comparator.reverseComparator : comparator;
    if (range.start.remaining() > 0
        && range.finish.remaining() > 0
        && orderedComparator.compare(range.start, range.finish) > 0)
    {
        throw new org.apache.cassandra.exceptions.InvalidRequestException("range finish must come after start in the order of traversal");
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:25,代码来源:ThriftValidation.java


注:本文中的org.apache.cassandra.serializers.MarshalException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。