@Override public String toString() { return MoreObjects.toStringHelper(this) .add("name", name).add("description", description) .toString(); } }
@Override public String toString() { Joiner.MapJoiner mapJoiner = Joiner.on(',').withKeyValueSeparator("="); return "NamespaceTableAndRegionInfo [name=" + name + ", tableAndRegionInfo=" + mapJoiner.join(tableAndRegionInfo) + "]"; } }
public ColumnValueFilter(final byte[] family, final byte[] qualifier, final CompareOperator op, final ByteArrayComparable comparator) { this.family = Preconditions.checkNotNull(family, "family should not be null."); this.qualifier = qualifier == null ? new byte[0] : qualifier; this.op = Preconditions.checkNotNull(op, "CompareOperator should not be null"); this.comparator = Preconditions.checkNotNull(comparator, "Comparator should not be null"); }
private void sanityCheckConfigs() { Preconditions.checkArgument(acceptableFactor <= 1 && acceptableFactor >= 0, ACCEPT_FACTOR_CONFIG_NAME + " must be between 0.0 and 1.0"); Preconditions.checkArgument(minFactor <= 1 && minFactor >= 0, MIN_FACTOR_CONFIG_NAME + " must be between 0.0 and 1.0"); Preconditions.checkArgument(minFactor <= acceptableFactor, MIN_FACTOR_CONFIG_NAME + " must be <= " + ACCEPT_FACTOR_CONFIG_NAME); Preconditions.checkArgument(extraFreeFactor >= 0, EXTRA_FREE_FACTOR_CONFIG_NAME + " must be greater than 0.0"); Preconditions.checkArgument(singleFactor <= 1 && singleFactor >= 0, SINGLE_FACTOR_CONFIG_NAME + " must be between 0.0 and 1.0"); Preconditions.checkArgument(multiFactor <= 1 && multiFactor >= 0, MULTI_FACTOR_CONFIG_NAME + " must be between 0.0 and 1.0"); Preconditions.checkArgument(memoryFactor <= 1 && memoryFactor >= 0, MEMORY_FACTOR_CONFIG_NAME + " must be between 0.0 and 1.0"); Preconditions.checkArgument((singleFactor + multiFactor + memoryFactor) == 1, SINGLE_FACTOR_CONFIG_NAME + ", " + MULTI_FACTOR_CONFIG_NAME + ", and " + MEMORY_FACTOR_CONFIG_NAME + " segments must add up to 1.0"); }
/** * Upon construction, this method will be called with the region * to be governed. It will be called once and only once. */ protected void configureForRegion(HRegion region) { Preconditions.checkState( this.region == null, "Policy already configured for region {}", this.region); this.region = region; }
@Override public void setKey(Key key) { Preconditions.checkNotNull(key, "Key cannot be null"); this.key = key; }
@Override public AsyncBufferedMutatorBuilder setWriteBufferSize(long writeBufferSize) { Preconditions.checkArgument(writeBufferSize > 0, "writeBufferSize %d must be >= 0", writeBufferSize); this.writeBufferSize = writeBufferSize; return this; }
@Override public CheckAndMutateBuilder ifMatches(CompareOperator compareOp, byte[] value) { this.op = Preconditions.checkNotNull(compareOp, "compareOp is null"); this.value = Preconditions.checkNotNull(value, "value is null"); return this; }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("numRows", numRows) .add("elapsedTime", elapsedTime) .toString(); } }
static short toShort(byte hi, byte lo) { short s = (short) (((hi & 0xFF) << 8) | (lo & 0xFF)); Preconditions.checkArgument(s >= 0); return s; } }
public CoprocessorServiceBuilderImpl(Function<RpcChannel, S> stubMaker, ServiceCaller<S, R> callable, CoprocessorCallback<R> callback) { this.stubMaker = Preconditions.checkNotNull(stubMaker, "stubMaker is null"); this.callable = Preconditions.checkNotNull(callable, "callable is null"); this.callback = Preconditions.checkNotNull(callback, "callback is null"); }
@Override public String toString() { return org.apache.hbase.thirdparty.com.google.common.base.MoreObjects. toStringHelper(this).add("startRow", startRow) .add("stopRow", stopRow).toString(); } }
public MiniBatchOperationInProgress(T[] operations, OperationStatus[] retCodeDetails, WALEdit[] walEditsFromCoprocessors, int firstIndex, int lastIndexExclusive, int readyToWriteCount) { Preconditions.checkArgument(readyToWriteCount <= (lastIndexExclusive - firstIndex)); this.operations = operations; this.retCodeDetails = retCodeDetails; this.walEditsFromCoprocessors = walEditsFromCoprocessors; this.firstIndex = firstIndex; this.lastIndexExclusive = lastIndexExclusive; this.readyToWriteCount = readyToWriteCount; }
@Override public CheckAndMutateBuilder qualifier(byte[] qualifier) { this.qualifier = Preconditions.checkNotNull(qualifier, "qualifier is null. Consider using" + " an empty byte array, or just do not call this method if you want a null qualifier"); return this; }
/** Scale valueIn in the range [baseMin,baseMax] to the range [limitMin,limitMax] */ private static double scale(double valueIn, double baseMin, double baseMax, double limitMin, double limitMax) { Preconditions.checkArgument(baseMin <= baseMax, "Illegal source range [%s,%s]", baseMin, baseMax); Preconditions.checkArgument(limitMin <= limitMax, "Illegal target range [%s,%s]", limitMin, limitMax); Preconditions.checkArgument(valueIn >= baseMin && valueIn <= baseMax, "Value %s must be within the range [%s,%s]", valueIn, baseMin, baseMax); return ((limitMax - limitMin) * (valueIn - baseMin) / (baseMax - baseMin)) + limitMin; } }
public WriterFactory withPath(FileSystem fs, Path path) { Preconditions.checkNotNull(fs); Preconditions.checkNotNull(path); this.fs = fs; this.path = path; return this; }
/** * Creates a DynamicClassLoader that can load classes dynamically * from jar files under a specific folder. * * @param parent the parent ClassLoader to set. */ public ClassLoaderBase(final ClassLoader parent) { super(new URL[]{}, parent); Preconditions.checkNotNull(parent, "No parent classloader!"); this.parent = parent; }
/** * Use either this method or {@link #withFilePath}, but not both. * @param dir Path to column family directory. The directory is created if * does not exist. The file is given a unique name within this * directory. * @return this (for chained invocation) */ public Builder withOutputDir(Path dir) { Preconditions.checkNotNull(dir); this.dir = dir; return this; }
@Override public CoprocessorServiceBuilderImpl<S, R> toRow(byte[] endKey, boolean inclusive) { this.endKey = Preconditions.checkNotNull(endKey, "endKey is null. Consider using" + " an empty byte array, or just do not call this method if you want to continue" + " selection to the last region"); this.endKeyInclusive = inclusive; return this; }