protected void setKeyType(Type keyType) { Preconditions.checkState(this.keyType == null, "Only one key type can be built with a MapBuilder"); this.keyType = keyType; }
protected void setKeyType(Type keyType) { Preconditions.checkState(this.keyType == null, "Only one key type can be built with a MapBuilder"); this.keyType = keyType; }
public ParquetMetadata getFooter() { Preconditions.checkState(state == STATE.ENDED, "Cannot return unfinished footer."); return footer; }
protected void setValueType(Type valueType) { Preconditions.checkState(this.valueType == null, "Only one key type can be built with a ValueBuilder"); this.valueType = valueType; }
protected void setValueType(Type valueType) { Preconditions.checkState(this.valueType == null, "Only one key type can be built with a ValueBuilder"); this.valueType = valueType; }
public ParquetMetadata getFooter() { Preconditions.checkState(state == STATE.ENDED, "Cannot return unfinished footer."); return footer; }
public THIS setElementType(Type elementType) { Preconditions.checkState(this.elementType == null, "Only one element can be built with a ListBuilder"); this.elementType = elementType; return self(); }
public THIS setElementType(Type elementType) { Preconditions.checkState(this.elementType == null, "Only one element can be built with a ListBuilder"); this.elementType = elementType; return self(); }
/** * See docs on CodecFactory#createDirectCodecFactory which is how this class is * exposed publicly and is just a pass-through factory method for this constructor * to hide the rest of this class from public access. */ DirectCodecFactory(Configuration config, ByteBufferAllocator allocator, int pageSize) { super(config, pageSize); Preconditions.checkNotNull(allocator, "allocator"); Preconditions.checkState(allocator.isDirect(), "A %s requires a direct buffer allocator be provided.", getClass().getSimpleName()); this.allocator = allocator; }
/** * See docs on CodecFactory#createDirectCodecFactory which is how this class is * exposed publicly and is just a pass-through factory method for this constructor * to hide the rest of this class from public access. */ DirectCodecFactory(Configuration config, ByteBufferAllocator allocator, int pageSize) { super(config, pageSize); Preconditions.checkNotNull(allocator, "allocator"); Preconditions.checkState(allocator.isDirect(), "A %s requires a direct buffer allocator be provided.", getClass().getSimpleName()); this.allocator = allocator; }
/** * Returns this method as a BoundMethod for the given receiver. * * @param receiver an Object to receive the method invocation * @return a {@link BoundMethod} for this method and the receiver * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible */ public BoundMethod bind(Object receiver) { Preconditions.checkState(!isStatic(), "Cannot bind static method " + method.toGenericString()); Preconditions.checkArgument( method.getDeclaringClass().isAssignableFrom(receiver.getClass()), "Cannot bind " + method.toGenericString() + " to instance of " + receiver.getClass()); return new BoundMethod(this, receiver); }
/** * Returns this method as a BoundMethod for the given receiver. * * @param receiver an Object to receive the method invocation * @return a {@link BoundMethod} for this method and the receiver * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible */ public BoundMethod bind(Object receiver) { Preconditions.checkState(!isStatic(), "Cannot bind static method " + method.toGenericString()); Preconditions.checkArgument( method.getDeclaringClass().isAssignableFrom(receiver.getClass()), "Cannot bind " + method.toGenericString() + " to instance of " + receiver.getClass()); return new BoundMethod(this, receiver); }
/** * Returns this method as a StaticMethod. * * @return a {@link StaticMethod} for this method * @throws IllegalStateException if the method is not static */ public StaticMethod asStatic() { Preconditions.checkState(isStatic(), "Method is not static"); return new StaticMethod(this); }
/** * Returns this method as a StaticMethod. * * @return a {@link StaticMethod} for this method * @throws IllegalStateException if the method is not static */ public StaticMethod asStatic() { Preconditions.checkState(isStatic(), "Method is not static"); return new StaticMethod(this); }
case JSON: case BSON: Preconditions.checkState( primitiveType == PrimitiveTypeName.BINARY, originalType.toString() + " can only annotate binary fields"); break; case DECIMAL: Preconditions.checkState( (primitiveType == PrimitiveTypeName.INT32) || (primitiveType == PrimitiveTypeName.INT64) || ); if (primitiveType == PrimitiveTypeName.INT32) { Preconditions.checkState( meta.getPrecision() <= MAX_PRECISION_INT32, "INT32 cannot store " + meta.getPrecision() + " digits " + "(max " + MAX_PRECISION_INT32 + ")"); } else if (primitiveType == PrimitiveTypeName.INT64) { Preconditions.checkState( meta.getPrecision() <= MAX_PRECISION_INT64, "INT64 cannot store " + meta.getPrecision() + " digits " + Preconditions.checkState( meta.getPrecision() <= maxPrecision(length), "FIXED(" + length + ") cannot store " + meta.getPrecision() + case INT_16: case INT_32: Preconditions.checkState(primitiveType == PrimitiveTypeName.INT32,
@Override protected Type build(String name) { Preconditions.checkState(logicalTypeAnnotation == null, "LIST is already the logical type and can't be changed"); Preconditions.checkNotNull(elementType, "List element type"); GroupBuilder<GroupType> builder = buildGroup(repetition).as(OriginalType.LIST); if (id != null) { builder.id(id.intValue()); } return builder .repeatedGroup().addFields(elementType).named("list") .named(name); }
@Override protected Type build(String name) { Preconditions.checkState(originalType == null, "LIST is already the logical type and can't be changed"); Preconditions.checkNotNull(elementType, "List element type"); GroupBuilder<GroupType> builder = buildGroup(repetition).as(OriginalType.LIST); if (id != null) { builder.id(id.intValue()); } return builder .repeatedGroup().addFields(elementType).named("list") .named(name); }
@Override protected Type build(String name) { Preconditions.checkState(originalType == null, "MAP is already a logical type and can't be changed."); if (keyType == null) { keyType = STRING_KEY; } GroupBuilder<GroupType> builder = buildGroup(repetition).as(OriginalType.MAP); if (id != null) { builder.id(id.intValue()); } if (valueType != null) { return builder .repeatedGroup().addFields(keyType, valueType).named("map") .named(name); } else { return builder .repeatedGroup().addFields(keyType).named("map") .named(name); } } }
@Override protected Type build(String name) { Preconditions.checkState(logicalTypeAnnotation == null, "MAP is already a logical type and can't be changed."); if (keyType == null) { keyType = STRING_KEY; } GroupBuilder<GroupType> builder = buildGroup(repetition).as(OriginalType.MAP); if (id != null) { builder.id(id.intValue()); } if (valueType != null) { return builder .repeatedGroup().addFields(keyType, valueType).named("map") .named(name); } else { return builder .repeatedGroup().addFields(keyType).named("map") .named(name); } } }