• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ColumnToCollectionType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.db.marshal.ColumnToCollectionType的典型用法代码示例。如果您正苦于以下问题:Java ColumnToCollectionType类的具体用法?Java ColumnToCollectionType怎么用?Java ColumnToCollectionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ColumnToCollectionType类属于org.apache.cassandra.db.marshal包,在下文中一共展示了ColumnToCollectionType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCollectionType

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
public ColumnToCollectionType getCollectionType()
{
    if (!hasCollections)
        return null;

    CompositeType composite = (CompositeType)cfm.comparator;
    return (ColumnToCollectionType)composite.types.get(composite.types.size() - 1);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:9,代码来源:CFDefinition.java


示例2: makeCType

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
protected static CompoundCType makeCType(CompoundCType clusteringType, AbstractType<?> columnNameType, ColumnToCollectionType collectionType)
{
    List<AbstractType<?>> allSubtypes = new ArrayList<AbstractType<?>>(clusteringType.size() + (collectionType == null ? 1 : 2));
    for (int i = 0; i < clusteringType.size(); i++)
        allSubtypes.add(clusteringType.subtype(i));
    allSubtypes.add(columnNameType);
    if (collectionType != null)
        allSubtypes.add(collectionType);
    return new CompoundCType(allSubtypes);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:11,代码来源:CompoundSparseCellNameType.java


示例3: addOrUpdateCollection

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
@Override
public CellNameType addOrUpdateCollection(ColumnIdentifier columnName, CollectionType newCollection)
{
    Map<ByteBuffer, CollectionType> newMap = new HashMap<>(collectionType.defined);
    newMap.put(columnName.bytes, newCollection);
    return new WithCollection(clusteringType, ColumnToCollectionType.getInstance(newMap), internedIds);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:8,代码来源:CompoundSparseCellNameType.java


示例4: addCollection

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
@Override
public CellNameType addCollection(ColumnIdentifier columnName, CollectionType newCollection)
{
    Map<ByteBuffer, CollectionType> newMap = new HashMap<>(collectionType.defined);
    newMap.put(columnName.bytes, newCollection);
    return new WithCollection(clusteringType, ColumnToCollectionType.getInstance(newMap), internedIds);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:8,代码来源:CompoundSparseCellNameType.java


示例5: collectionType

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
public ColumnToCollectionType collectionType()
{
    throw new UnsupportedOperationException();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:AbstractCellNameType.java


示例6: validateColumnNames

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
/**
 * Validates the column names but not the parent path or data
 */
private static void validateColumnNames(CFMetaData metadata, ByteBuffer superColumnName, Iterable<ByteBuffer> column_names)
throws org.apache.cassandra.exceptions.InvalidRequestException
{
    int maxNameLength = Cell.MAX_NAME_LENGTH;

    if (superColumnName != null)
    {
        if (superColumnName.remaining() > maxNameLength)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name length must not be greater than " + maxNameLength);
        if (superColumnName.remaining() == 0)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
        if (metadata.cfType == ColumnFamilyType.Standard)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
    }
    AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, superColumnName);
    boolean isCQL3Table = !metadata.isThriftCompatible();
    for (ByteBuffer name : column_names)
    {
        if (name.remaining() > maxNameLength)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + maxNameLength);
        if (name.remaining() == 0)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("column name must not be empty");
        try
        {
            comparator.validate(name);
        }
        catch (MarshalException e)
        {
            throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
        }

        if (isCQL3Table)
        {
            // CQL3 table don't support having only part of their composite column names set
            Composite composite = metadata.comparator.fromByteBuffer(name);

            int minComponents = metadata.comparator.clusteringPrefixSize() + 1;
            if (composite.size() < minComponents)
                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Not enough components (found %d but %d expected) for column name since %s is a CQL3 table",
                                                                                                composite.size(), minComponents, metadata.cfName));

            // Furthermore, the column name must be a declared one.
            int columnIndex = metadata.comparator.clusteringPrefixSize();
            ByteBuffer CQL3ColumnName = composite.get(columnIndex);
            if (!CQL3ColumnName.hasRemaining())
                continue; // Row marker, ok

            ColumnIdentifier columnId = new ColumnIdentifier(CQL3ColumnName, metadata.comparator.subtype(columnIndex));
            if (metadata.getColumnDefinition(columnId) == null)
                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Invalid cell for CQL3 table %s. The CQL3 column component (%s) does not correspond to a defined CQL3 column",
                                                                                                metadata.cfName, columnId));

            // On top of that, if we have a collection component, he (CQL3) column must be a collection
            if (metadata.comparator.hasCollections() && composite.size() == metadata.comparator.size())
            {
                ColumnToCollectionType collectionType = metadata.comparator.collectionType();
                if (!collectionType.defined.containsKey(CQL3ColumnName))
                    throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Invalid collection component, %s is not a collection", UTF8Type.instance.getString(CQL3ColumnName)));
            }
        }
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:66,代码来源:ThriftValidation.java


示例7: getTypeCount

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
private static int getTypeCount(CompositeType ct)
{
    return ct.types.get(ct.types.size() - 1) instanceof ColumnToCollectionType ? ct.types.size() - 1 : ct.types.size();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:5,代码来源:ColumnNameHelper.java


示例8: WithCollection

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
public WithCollection(List<AbstractType<?>> types, ColumnToCollectionType collectionType)
{
    this(new CompoundCType(types), collectionType);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:5,代码来源:CompoundSparseCellNameType.java


示例9: collectionType

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
@Override
public ColumnToCollectionType collectionType()
{
    return collectionType;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:6,代码来源:CompoundSparseCellNameType.java


示例10: validateColumnNames

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
/**
 * Validates the column names but not the parent path or data
 */
private static void validateColumnNames(CFMetaData metadata, ByteBuffer superColumnName, Iterable<ByteBuffer> column_names)
throws org.apache.cassandra.exceptions.InvalidRequestException
{
    int maxNameLength = Cell.MAX_NAME_LENGTH;

    if (superColumnName != null)
    {
        if (superColumnName.remaining() > maxNameLength)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name length must not be greater than " + maxNameLength);
        if (superColumnName.remaining() == 0)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
        if (metadata.cfType == ColumnFamilyType.Standard)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to table " + metadata.cfName + " containing normal columns");
    }
    AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, superColumnName);
    boolean isCQL3Table = !metadata.isThriftCompatible();
    for (ByteBuffer name : column_names)
    {
        if (name.remaining() > maxNameLength)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + maxNameLength);
        if (name.remaining() == 0)
            throw new org.apache.cassandra.exceptions.InvalidRequestException("column name must not be empty");
        try
        {
            comparator.validate(name);
        }
        catch (MarshalException e)
        {
            throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
        }

        if (isCQL3Table)
        {
            // CQL3 table don't support having only part of their composite column names set
            Composite composite = metadata.comparator.fromByteBuffer(name);

            int minComponents = metadata.comparator.clusteringPrefixSize() + 1;
            if (composite.size() < minComponents)
                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Not enough components (found %d but %d expected) for column name since %s is a CQL3 table",
                                                                                                composite.size(), minComponents, metadata.cfName));

            // Furthermore, the column name must be a declared one.
            int columnIndex = metadata.comparator.clusteringPrefixSize();
            ByteBuffer CQL3ColumnName = composite.get(columnIndex);
            if (!CQL3ColumnName.hasRemaining())
                continue; // Row marker, ok

            ColumnIdentifier columnId = new ColumnIdentifier(CQL3ColumnName, metadata.comparator.subtype(columnIndex));
            if (metadata.getColumnDefinition(columnId) == null)
                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Invalid cell for CQL3 table %s. The CQL3 column component (%s) does not correspond to a defined CQL3 column",
                                                                                                metadata.cfName, columnId));

            // On top of that, if we have a collection component, he (CQL3) column must be a collection
            if (metadata.comparator.hasCollections() && composite.size() == metadata.comparator.size())
            {
                ColumnToCollectionType collectionType = metadata.comparator.collectionType();
                if (!collectionType.defined.containsKey(CQL3ColumnName))
                    throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Invalid collection component, %s is not a collection", UTF8Type.instance.getString(CQL3ColumnName)));
            }
        }
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:66,代码来源:ThriftValidation.java


示例11: collectionType

import org.apache.cassandra.db.marshal.ColumnToCollectionType; //导入依赖的package包/类
/**
 * The type of the collections (or null if the type does not have any non-frozen collections).
 */
public ColumnToCollectionType collectionType();
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:CellNameType.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DocumentationManagerProtocol类代码示例发布时间:2022-05-22
下一篇:
Java OpenOfficeConnection类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap