本文整理了Java中org.apache.hbase.thirdparty.com.google.common.base.Preconditions.checkNotNull()
方法的一些代码示例,展示了Preconditions.checkNotNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Preconditions.checkNotNull()
方法的具体详情如下:
包路径:org.apache.hbase.thirdparty.com.google.common.base.Preconditions
类名称:Preconditions
方法名:checkNotNull
[英]Ensures that an object reference passed as a parameter to the calling method is not null.
[中]确保作为参数传递给调用方法的对象引用不为null。
代码示例来源:origin: apache/hbase
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");
}
代码示例来源:origin: apache/hbase
@Override
public void setKey(Key key) {
Preconditions.checkNotNull(key, "Key cannot be null");
this.key = key;
}
代码示例来源:origin: apache/hbase
@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;
}
代码示例来源:origin: apache/hbase
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");
}
代码示例来源:origin: apache/hbase
@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;
}
代码示例来源:origin: apache/hbase
public WriterFactory withComparator(CellComparator comparator) {
Preconditions.checkNotNull(comparator);
this.comparator = comparator;
return this;
}
代码示例来源:origin: apache/hbase
@Override
public void setKey(Key key) {
Preconditions.checkNotNull(key, "Key cannot be null");
this.key = key;
}
代码示例来源:origin: apache/hbase
public Builder withComparator(CellComparator comparator) {
Preconditions.checkNotNull(comparator);
this.comparator = comparator;
return this;
}
代码示例来源:origin: apache/hbase
@Override
public CheckAndMutateBuilder ifMatches(CompareOperator compareOp, byte[] value) {
if (compareOp == CompareOperator.EQUAL) {
this.value = Preconditions.checkNotNull(value, "value is null");
return this;
} else {
throw new UnsupportedOperationException("CheckAndMutate for non-equal comparison " +
"not implemented");
}
}
代码示例来源:origin: apache/hbase
@Override
public CompletableFuture<Void> compactRegion(byte[] regionName, byte[] columnFamily) {
Preconditions.checkNotNull(columnFamily, "columnFamily is null."
+ " If you don't specify a columnFamily, use compactRegion(regionName) instead");
return compactRegion(regionName, columnFamily, false);
}
代码示例来源:origin: apache/hbase
@Override
public CompletableFuture<Void> deleteTableSnapshots(Pattern tableNamePattern) {
Preconditions.checkNotNull(tableNamePattern, "tableNamePattern is null."
+ " If you don't specify a tableNamePattern, use deleteSnapshots() instead");
return internalDeleteSnapshots(tableNamePattern, null);
}
代码示例来源:origin: apache/hbase
@Override
public OutputStream createEncryptionStream(OutputStream out, Encryptor e) throws IOException {
Preconditions.checkNotNull(e);
return e.createEncryptionStream(out);
}
代码示例来源:origin: apache/hbase
@Override
public void callMethod(Descriptors.MethodDescriptor md, RpcController controller,
Message param, Message returnType, RpcCallback<Message> done) {
// This method does not throw any exceptions, so the caller must provide a
// HBaseRpcController which is used to pass the exceptions.
this.rpcClient.callMethod(md,
configureRpcController(Preconditions.checkNotNull(controller,
"RpcController can not be null for async rpc call")),
param, returnType, ticket, addr, done);
}
}
代码示例来源:origin: apache/hbase
@Override
public void setIv(byte[] iv) {
Preconditions.checkNotNull(iv, "IV cannot be null");
Preconditions.checkArgument(iv.length == AES.IV_LENGTH, "Invalid IV length");
this.iv = iv;
}
代码示例来源:origin: apache/hbase
@Override
public CompletableFuture<List<SnapshotDescription>> listSnapshots(Pattern pattern) {
Preconditions.checkNotNull(pattern,
"pattern is null. If you don't specify a pattern, use listSnapshots() instead");
return getCompletedSnapshots(pattern);
}
代码示例来源:origin: apache/hbase
@Override
public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException {
Preconditions.checkNotNull(d);
return d.createDecryptionStream(in);
}
代码示例来源:origin: apache/hbase
/**
* {@link #listTableDescriptors(boolean)}
*/
@Override
public CompletableFuture<List<TableDescriptor>> listTableDescriptors(Pattern pattern,
boolean includeSysTables) {
Preconditions.checkNotNull(pattern,
"pattern is null. If you don't specify a pattern, use listTables(boolean) instead");
return getTableDescriptors(RequestConverter.buildGetTableDescriptorsRequest(pattern,
includeSysTables));
}
代码示例来源:origin: apache/hbase
@Override
public OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv)
throws IOException {
Preconditions.checkNotNull(context);
Preconditions.checkState(context.getKey() != null, "Context does not have a key");
Preconditions.checkNotNull(iv);
Encryptor e = getEncryptor();
e.setKey(context.getKey());
e.setIv(iv);
return e.createEncryptionStream(out);
}
代码示例来源:origin: apache/hbase
@Override
public void run() {
Preconditions.checkNotNull(server);
if (server.isStopped()
|| (region.getTableDescriptor() != null && !region.getTableDescriptor().isCompactionEnabled())) {
region.decrementCompactionsQueuedCount();
return;
}
doCompaction(user);
}
代码示例来源:origin: apache/hbase
@Override
public CompletableFuture<Void> createTable(TableDescriptor desc, byte[][] splitKeys) {
Preconditions.checkNotNull(splitKeys, "splitKeys is null. If you don't specify splitKeys,"
+ " use createTable(TableDescriptor) instead");
try {
verifySplitKeys(splitKeys);
return createTable(desc.getTableName(), RequestConverter.buildCreateTableRequest(desc,
splitKeys, ng.getNonceGroup(), ng.newNonce()));
} catch (IllegalArgumentException e) {
return failedFuture(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!