public TupleType(List<AbstractType<?>> types) { for (int i = 0; i < types.size(); i++) types.set(i, types.get(i).freeze()); this.types = types; }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; if (elements.isFreezable() && elements.isMultiCell()) return getInstance(elements.freeze(), isMultiCell); return getInstance(elements.freezeNestedMulticellTypes(), isMultiCell); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; if (elements.isFreezable() && elements.isMultiCell()) return getInstance(elements.freeze(), isMultiCell); return getInstance(elements.freezeNestedMulticellTypes(), isMultiCell); }
public static TupleType getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> types = parser.getTypeParameters(); for (int i = 0; i < types.size(); i++) types.set(i, types.get(i).freeze()); return new TupleType(types); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; if (elements.isFreezable() && elements.isMultiCell()) return getInstance(elements.freeze(), isMultiCell); return getInstance(elements.freezeNestedMulticellTypes(), isMultiCell); }
public static AbstractType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> innerTypes = parser.getTypeParameters(); if (innerTypes.size() != 1) throw new SyntaxException("FrozenType() only accepts one parameter"); AbstractType<?> innerType = innerTypes.get(0); return innerType.freeze(); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; if (elements.isFreezable() && elements.isMultiCell()) return getInstance(elements.freeze(), isMultiCell); return getInstance(elements.freezeNestedMulticellTypes(), isMultiCell); }
public static TupleType getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> types = parser.getTypeParameters(); for (int i = 0; i < types.size(); i++) types.set(i, types.get(i).freeze()); return new TupleType(types); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; if (elements.isFreezable() && elements.isMultiCell()) return getInstance(elements.freeze(), isMultiCell); return getInstance(elements.freezeNestedMulticellTypes(), isMultiCell); }
public static TupleType getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> types = parser.getTypeParameters(); for (int i = 0; i < types.size(); i++) types.set(i, types.get(i).freeze()); return new TupleType(types); }
public static AbstractType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> innerTypes = parser.getTypeParameters(); if (innerTypes.size() != 1) throw new SyntaxException("FrozenType() only accepts one parameter"); AbstractType<?> innerType = innerTypes.get(0); return innerType.freeze(); }
public static AbstractType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> innerTypes = parser.getTypeParameters(); if (innerTypes.size() != 1) throw new SyntaxException("FrozenType() only accepts one parameter"); AbstractType<?> innerType = innerTypes.get(0); return innerType.freeze(); }
public static AbstractType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException { List<AbstractType<?>> innerTypes = parser.getTypeParameters(); if (innerTypes.size() != 1) throw new SyntaxException("FrozenType() only accepts one parameter"); AbstractType<?> innerType = innerTypes.get(0); return innerType.freeze(); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; // the behavior here doesn't exactly match the method name: we want to freeze everything inside of UDTs List<AbstractType<?>> newTypes = fieldTypes().stream() .map(subtype -> (subtype.isFreezable() && subtype.isMultiCell() ? subtype.freeze() : subtype)) .collect(Collectors.toList()); return new UserType(keyspace, name, fieldNames, newTypes, isMultiCell); }
@Override public AbstractType<?> freezeNestedMulticellTypes() { if (!isMultiCell()) return this; // the behavior here doesn't exactly match the method name: we want to freeze everything inside of UDTs List<AbstractType<?>> newTypes = fieldTypes().stream() .map(subtype -> (subtype.isFreezable() && subtype.isMultiCell() ? subtype.freeze() : subtype)) .collect(Collectors.toList()); return new UserType(keyspace, name, fieldNames, newTypes, isMultiCell); }
public final AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver) { // We should ignore the fact that the receiver type is frozen in our comparison as functions do not support // frozen types for return type AbstractType<?> returnType = returnType(); if (receiver.type.isFreezable() && !receiver.type.isMultiCell()) returnType = returnType.freeze(); if (receiver.type.equals(returnType)) return AssignmentTestable.TestResult.EXACT_MATCH; if (receiver.type.isValueCompatibleWith(returnType)) return AssignmentTestable.TestResult.WEAKLY_ASSIGNABLE; return AssignmentTestable.TestResult.NOT_ASSIGNABLE; }
public final AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver) { // We should ignore the fact that the receiver type is frozen in our comparison as functions do not support // frozen types for return type AbstractType<?> returnType = returnType(); if (receiver.type.isFreezable() && !receiver.type.isMultiCell()) returnType = returnType.freeze(); if (receiver.type.equals(returnType)) return AssignmentTestable.TestResult.EXACT_MATCH; if (receiver.type.isValueCompatibleWith(returnType)) return AssignmentTestable.TestResult.WEAKLY_ASSIGNABLE; return AssignmentTestable.TestResult.NOT_ASSIGNABLE; }
public final AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver) { // We should ignore the fact that the receiver type is frozen in our comparison as functions do not support // frozen types for return type AbstractType<?> returnType = returnType(); if (receiver.type.isFreezable() && !receiver.type.isMultiCell()) returnType = returnType.freeze(); if (receiver.type.equals(returnType)) return AssignmentTestable.TestResult.EXACT_MATCH; if (receiver.type.isValueCompatibleWith(returnType)) return AssignmentTestable.TestResult.WEAKLY_ASSIGNABLE; return AssignmentTestable.TestResult.NOT_ASSIGNABLE; }
static void addAggregateToSchemaMutation(UDAggregate aggregate, Mutation.SimpleBuilder builder) { builder.update(Aggregates) .row(aggregate.name().name, functionArgumentsList(aggregate)) .add("return_type", aggregate.returnType().asCQL3Type().toString()) .add("state_func", aggregate.stateFunction().name().name) .add("state_type", aggregate.stateType().asCQL3Type().toString()) .add("final_func", aggregate.finalFunction() != null ? aggregate.finalFunction().name().name : null) .add("initcond", aggregate.initialCondition() != null // must use the frozen state type here, as 'null' for unfrozen collections may mean 'empty' ? aggregate.stateType().freeze().asCQL3Type().toCQLLiteral(aggregate.initialCondition(), ProtocolVersion.CURRENT) : null); }
static void addAggregateToSchemaMutation(UDAggregate aggregate, Mutation.SimpleBuilder builder) { builder.update(Aggregates) .row(aggregate.name().name, functionArgumentsList(aggregate)) .add("return_type", aggregate.returnType().asCQL3Type().toString()) .add("state_func", aggregate.stateFunction().name().name) .add("state_type", aggregate.stateType().asCQL3Type().toString()) .add("final_func", aggregate.finalFunction() != null ? aggregate.finalFunction().name().name : null) .add("initcond", aggregate.initialCondition() != null // must use the frozen state type here, as 'null' for unfrozen collections may mean 'empty' ? aggregate.stateType().freeze().asCQL3Type().toCQLLiteral(aggregate.initialCondition(), ProtocolVersion.CURRENT) : null); }