@Override public String toString() { return name.toString(); }
protected ColumnIdentifier idFor(ByteBuffer bb) { ColumnIdentifier id = internedIds.get(bb); return id == null ? new ColumnIdentifier(bb, columnNameType) : id; }
public boolean apply(RawSelector raw) { return name.equals(raw.alias); } });
@Override protected String getColumnNameCQL3() { return ColumnIdentifier.maybeQuote(def.name.toString()); }
@Override public String toString() { return ColumnIdentifier.maybeQuote(text); } }
public AbstractReadCommandBuilder columns(String... columns) { if (this.columns == null) this.columns = new HashSet<>(); for (String column : columns) this.columns.add(ColumnIdentifier.getInterned(column, true)); return this; }
@Override public String toString() { return column.name.toCQLString(); } }
private ColumnIdentifier(ByteBuffer bytes, String text, boolean interned) { this.bytes = bytes; this.text = text; this.interned = interned; this.prefixComparison = prefixComparison(bytes); }
public int compareTo(ColumnDefinition other) { if (this == other) return 0; if (comparisonOrder != other.comparisonOrder) return Long.compare(comparisonOrder, other.comparisonOrder); return this.name.compareTo(other.name); }
@Override public int hashCode() { // This achieves the same as Objects.hashcode, but avoids the object array allocation // which features significantly in the allocation profile and caches the result. int result = hash; if(result == 0) { result = 31 + (ksName == null ? 0 : ksName.hashCode()); result = 31 * result + (cfName == null ? 0 : cfName.hashCode()); result = 31 * result + (name == null ? 0 : name.hashCode()); result = 31 * result + (type == null ? 0 : type.hashCode()); result = 31 * result + (kind == null ? 0 : kind.hashCode()); result = 31 * result + position; hash = result; } return result; }
@VisibleForTesting public ColumnDefinition(String ksName, String cfName, ColumnIdentifier name, AbstractType<?> type, int position, Kind kind) { super(ksName, cfName, name, type); assert name != null && type != null && kind != null; assert name.isInterned(); assert (position == NO_POSITION) == !kind.isPrimaryKeyKind(); // The position really only make sense for partition and clustering columns (and those must have one), // so make sure we don't sneak it for something else since it'd breaks equals() this.kind = kind; this.position = position; this.cellPathComparator = makeCellPathComparator(kind, type); this.cellComparator = cellPathComparator == null ? ColumnData.comparator : (a, b) -> cellPathComparator.compare(a.path(), b.path()); this.asymmetricCellPathComparator = cellPathComparator == null ? null : (a, b) -> cellPathComparator.compare(((Cell)a).path(), (CellPath) b); this.comparisonOrder = comparisonOrder(kind, isComplex(), Math.max(0, position), name); }
/** * Returns a string representation of the identifier that is safe to use directly in CQL queries. * If necessary, the string will be double-quoted, and any quotes inside the string will be escaped. */ public String toCQLString() { return maybeQuote(text); }
public AbstractReadCommandBuilder columns(String... columns) { if (this.columns == null) this.columns = new HashSet<>(); for (String column : columns) this.columns.add(ColumnIdentifier.getInterned(column, true)); return this; }
@Override public String toString() { return column.name.toCQLString(); } }
private ColumnIdentifier(ByteBuffer bytes, String text, boolean interned) { this.bytes = bytes; this.text = text; this.interned = interned; this.prefixComparison = prefixComparison(bytes); }
public int compareTo(ColumnDefinition other) { if (this == other) return 0; if (comparisonOrder != other.comparisonOrder) return Long.compare(comparisonOrder, other.comparisonOrder); return this.name.compareTo(other.name); }
@Override public int hashCode() { // This achieves the same as Objects.hashcode, but avoids the object array allocation // which features significantly in the allocation profile and caches the result. int result = hash; if(result == 0) { result = 31 + (ksName == null ? 0 : ksName.hashCode()); result = 31 * result + (cfName == null ? 0 : cfName.hashCode()); result = 31 * result + (name == null ? 0 : name.hashCode()); result = 31 * result + (type == null ? 0 : type.hashCode()); result = 31 * result + (kind == null ? 0 : kind.hashCode()); result = 31 * result + position; hash = result; } return result; }
@VisibleForTesting public ColumnDefinition(String ksName, String cfName, ColumnIdentifier name, AbstractType<?> type, int position, Kind kind) { super(ksName, cfName, name, type); assert name != null && type != null && kind != null; assert name.isInterned(); assert (position == NO_POSITION) == !kind.isPrimaryKeyKind(); // The position really only make sense for partition and clustering columns (and those must have one), // so make sure we don't sneak it for something else since it'd breaks equals() this.kind = kind; this.position = position; this.cellPathComparator = makeCellPathComparator(kind, type); this.cellComparator = cellPathComparator == null ? ColumnData.comparator : (a, b) -> cellPathComparator.compare(a.path(), b.path()); this.asymmetricCellPathComparator = cellPathComparator == null ? null : (a, b) -> cellPathComparator.compare(((Cell)a).path(), (CellPath) b); this.comparisonOrder = comparisonOrder(kind, isComplex(), Math.max(0, position), name); }
public UTName(ColumnIdentifier ksName, ColumnIdentifier utName) { this.ksName = ksName == null ? null : ksName.toString(); this.utName = utName; }
private ColumnSpecification timeToLiveReceiver(String ksName, String cfName) { return new ColumnSpecification(ksName, cfName, new ColumnIdentifier("[ttl]", true), Int32Type.instance); } }