org.apache.hc.core5.util.Args.notEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中org.apache.hc.core5.util.Args.notEmpty()方法的一些代码示例,展示了Args.notEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.notEmpty()方法的具体详情如下:
包路径:org.apache.hc.core5.util.Args
类名称:Args
方法名:notEmpty

Args.notEmpty介绍

暂无

代码示例

代码示例来源:origin: apache/httpcomponents-client

@Override
public Cancellable getEntry(final String key, final FutureCallback<HttpCacheEntry> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(callback, "Callback");
  try {
    final HttpCacheEntry entry = cacheStorage.getEntry(key);
    callback.completed(entry);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: apache/httpcomponents-client

@Override
public Cancellable removeEntry(final String key, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.removeEntry(key);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: apache/httpcomponents-client

@Override
public Cancellable updateEntry(
    final String key, final HttpCacheCASOperation casOperation, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(casOperation, "CAS operation");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.updateEntry(key, casOperation);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: apache/httpcomponents-client

@Override
public Cancellable putEntry(final String key, final HttpCacheEntry entry, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(entry, "Cache ehtry");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.putEntry(key, entry);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5

/**
 * Updates the auth state with a queue of auth options.
 *
 * @param authOptions a queue of auth options. May not be null or empty.
 */
public void setOptions(final Queue<AuthScheme> authOptions) {
  Args.notEmpty(authOptions, "Queue of auth options");
  this.authOptions = authOptions;
}

代码示例来源:origin: apache/httpcomponents-core

public RegistryBuilder<I> register(final String id, final I item) {
  Args.notEmpty(id, "ID");
  Args.notNull(item, "Item");
  items.put(id.toLowerCase(Locale.ROOT), item);
  return this;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

public RegistryBuilder<I> register(final String id, final I item) {
  Args.notEmpty(id, "ID");
  Args.notNull(item, "Item");
  items.put(id.toLowerCase(Locale.ROOT), item);
  return this;
}

代码示例来源:origin: apache/httpcomponents-core

public void encodeHeaders(
    final ByteArrayBuffer dst, final List<? extends Header> headers) throws CharacterCodingException {
  Args.notNull(dst, "ByteArrayBuffer");
  Args.notEmpty(headers, "Header list");
  encodeHeaders(dst, headers, false, true);
}

代码示例来源:origin: apache/httpcomponents-core

/**
 * @since 4.3
 */
public String getParameter(final String name) {
  Args.notEmpty(name, "Parameter name");
  if (this.params == null) {
    return null;
  }
  for (final NameValuePair param: this.params) {
    if (param.getName().equalsIgnoreCase(name)) {
      return param.getValue();
    }
  }
  return null;
}

代码示例来源:origin: apache/httpcomponents-core

public void encodeHeader(
    final ByteArrayBuffer dst, final String name, final String value, final boolean sensitive) throws CharacterCodingException {
  Args.notNull(dst, "ByteArrayBuffer");
  Args.notEmpty(name, "Header name");
  encodeHeader(dst, name, value, sensitive, false, true);
}

代码示例来源:origin: apache/httpcomponents-core

@Test(expected=IllegalArgumentException.class)
public void testArgCollectionNotEmptyFail2() {
  Args.notEmpty(Collections.emptyList(), "List");
}

代码示例来源:origin: apache/httpcomponents-core

@Test(expected=IllegalArgumentException.class)
public void testArgNotEmptyFail1() {
  Args.notEmpty((String) null, "Stuff");
}

代码示例来源:origin: apache/httpcomponents-core

@Test(expected=IllegalArgumentException.class)
public void testArgNotEmptyFail2() {
  Args.notEmpty("", "Stuff");
}

代码示例来源:origin: apache/httpcomponents-core

@Test(expected=IllegalArgumentException.class)
public void testArgCollectionNotEmptyFail1() {
  Args.notEmpty((List<?>) null, "List");
}

代码示例来源:origin: apache/httpcomponents-core

@Test
public void testArgCollectionNotEmptyPass() {
  final List<String> list = Arrays.asList("stuff");
  Assert.assertSame(list, Args.notEmpty(list, "List"));
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache

@Override
public Cancellable removeEntry(final String key, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.removeEntry(key);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache

@Override
public Cancellable getEntry(final String key, final FutureCallback<HttpCacheEntry> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(callback, "Callback");
  try {
    final HttpCacheEntry entry = cacheStorage.getEntry(key);
    callback.completed(entry);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: apache/httpcomponents-core

@Test
public void testArgNotEmptyPass() {
  final String stuff = "stuff";
  Assert.assertSame(stuff, Args.notEmpty(stuff, "Stuff"));
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache

@Override
public Cancellable updateEntry(
    final String key, final HttpCacheCASOperation casOperation, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(casOperation, "CAS operation");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.updateEntry(key, casOperation);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache

@Override
public Cancellable putEntry(final String key, final HttpCacheEntry entry, final FutureCallback<Boolean> callback) {
  Args.notEmpty(key, "Key");
  Args.notNull(entry, "Cache ehtry");
  Args.notNull(callback, "Callback");
  try {
    cacheStorage.putEntry(key, entry);
    callback.completed(Boolean.TRUE);
  } catch (final Exception ex) {
    callback.failed(ex);
  }
  return Operations.nonCancellable();
}

相关文章