dev.rico.internal.core.Assert类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(96)

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

Assert介绍

[英]A collection of utility methods that can assert the state of an instance.
[中]可以断言实例状态的实用程序方法的集合。

代码示例

代码示例来源:origin: dev.rico/rico-remoting-common

private JsonElement getElement(final JsonObject jsonObject, final String jsonElementName) {
    Assert.requireNonNull(jsonObject, "jsonObject");
    Assert.requireNonNull(jsonElementName, "jsonElementName");
    JsonElement element = jsonObject.get(jsonElementName);
    Assert.requireNonNull(element, "element");
    return element;
  }
}

代码示例来源:origin: dev.rico/rico-remoting-client

public ControllerProxyImpl(final String controllerId, final T model, final AbstractClientConnector clientConnector, final ClientPlatformBeanRepository platformBeanRepository, final ControllerProxyFactory controllerProxyFactory, final Converters converters) {
  this.clientConnector = Assert.requireNonNull(clientConnector, "clientConnector");
  this.controllerId = Assert.requireNonBlank(controllerId, "controllerId");
  this.controllerProxyFactory = Assert.requireNonNull(controllerProxyFactory, "controllerProxyFactory");
  this.model = model;
  this.platformBeanRepository = Assert.requireNonNull(platformBeanRepository, "platformBeanRepository");
  this.converters = Assert.requireNonNull(converters, "converters");
}

代码示例来源:origin: dev.rico/rico-remoting-common

protected void removeAttributeByQualifier(A attribute, String qualifier) {
  if (Assert.isBlank(qualifier)) return;
  List<A> list = attributesPerQualifier.get(qualifier);
  if (null == list) return;
  list.remove(attribute);
  if (list.isEmpty()) {
    attributesPerQualifier.remove(qualifier);
  }
}

代码示例来源:origin: dev.rico/rico-core

public static <T> T[] requireNonNullEntries(final T[] array, final String argumentName) {
  requireNonNull(array, "array");
  requireNonNullEntries(Arrays.asList(array), argumentName);
  return array;
}

代码示例来源:origin: dev.rico/rico-remoting-common

public void setControllerId(final String controllerId) {
    Assert.requireNonBlank(controllerId, "controllerId");
    this.controllerId = controllerId;
  }
}

代码示例来源:origin: dev.rico/rico-remoting-client

/**
 * Default constructor
 * @param name name of the param
 * @param value value of the param
 */
public Param(String name, Object value) {
  this.name = Assert.requireNonBlank(name, "name");
  this.value = value;
}

代码示例来源:origin: dev.rico/rico-client

public HttpCallResponseBuilderImpl(final HttpClientConnection connection, final InputStream dataProvider, final Gson gson, final List<HttpURLConnectionHandler> requestHandlers, final List<HttpURLConnectionHandler> responseHandlers, final ClientConfiguration configuration) {
  this.connection = Assert.requireNonNull(connection, "connection");
  this.dataProvider = Assert.requireNonNull(dataProvider, "dataProvider");
  this.gson = Assert.requireNonNull(gson, "gson");
  this.configuration = Assert.requireNonNull(configuration, "configuration");
  Assert.requireNonNull(requestHandlers, "requestHandlers");
  this.requestHandlers = Collections.unmodifiableList(requestHandlers);
  Assert.requireNonNull(responseHandlers, "responseHandlers");
  this.responseHandlers = Collections.unmodifiableList(responseHandlers);
}

代码示例来源:origin: dev.rico/rico-remoting-server

public ActionExceptionEventImpl(final String actionName, final String controllerName, final T throwable) {
  this.actionName = Assert.requireNonBlank(actionName, "actionName");
  this.controllerName = Assert.requireNonBlank(controllerName, "controllerName");
  this.throwable = Assert.requireNonNull(throwable, "throwable");
}

代码示例来源:origin: dev.rico/rico-remoting-common

public void setControllerId(final String controllerId) {
  Assert.requireNonBlank(controllerId, "controllerId");
  this.controllerId = controllerId;
}

代码示例来源:origin: dev.rico/rico-remoting-common

/**
 * Returns a {@code List} of all attributes that share the same qualifier.<br/>
 * Never returns null, but may return an empty list. The returned {@code List} is immutable.
 *
 * @return a {@code List} of all attributes with the specified qualifier.
 */
public List<A> findAllAttributesByQualifier(String qualifier) {
  if (Assert.isBlank(qualifier) || !attributesPerQualifier.containsKey(qualifier)) return Collections.emptyList();
  return Collections.unmodifiableList(attributesPerQualifier.get(qualifier));
}

代码示例来源:origin: dev.rico/rico-client

public ProcessChainImpl(final UiExecutor uiExecutor, final BackgroundExecutor backgroundExecutor, final ClientConfiguration clientConfiguration) {
  Assert.requireNonNull(clientConfiguration, "clientConfiguration");
  this.backgroundExecutor = Assert.requireNonNull(backgroundExecutor, "backgroundExecutor");
  this.uiExecutor = Assert.requireNonNull(uiExecutor, "uiExecutor");
  this.processes = new ArrayList<>();
  this.exceptionConsumer = null;
  this.finalRunnable = null;
}

代码示例来源:origin: dev.rico/rico-remoting-server

public RemotingContextTaskQueue(final String clientSessionId, final ClientSessionProvider sessionProvider, final CommunicationManager communicationManager, final long maxExecutionTime, final TimeUnit maxExecutionTimeUnit) {
  this.clientSessionId = Assert.requireNonBlank(clientSessionId, "clientSessionId");
  this.tasks = new LinkedBlockingQueue<>();
  this.communicationManager = Assert.requireNonNull(communicationManager, "communicationManager");
  this.sessionProvider = Assert.requireNonNull(sessionProvider, "sessionProvider");
  this.maxExecutionTime = maxExecutionTime;
  this.maxExecutionTimeUnit = Assert.requireNonNull(maxExecutionTimeUnit, "maxExecutionTimeUnit");
}

代码示例来源:origin: dev.rico/rico-core

public ContextImpl(final String key, final String value) {
  this.key = Assert.requireNonBlank(key, "key");
  this.value = value;
}

代码示例来源:origin: dev.rico/rico-remoting-common

protected void removePresentationModelByType(P model) {
  if (null == model) return;
  String type = model.getPresentationModelType();
  if (Assert.isBlank(type)) return;
  List<P> list = modelsPerType.get(type);
  if (null == list) return;
  list.remove(model);
  if (list.isEmpty()) {
    modelsPerType.remove(type);
  }
}

代码示例来源:origin: dev.rico/rico-server

public <T> T sync(final Callable<T> callable) throws Exception {
  Assert.requireNonNull(callable, "callable");
  synchronized (this) {
    return callable.call();
  }
}

代码示例来源:origin: dev.rico/rico-server

public Mutex getMutexForClientSession(final String sessionId) {
    Assert.requireNonBlank(sessionId, "sessionId");
    final WeakReference<Mutex> mutexReference = sessionMutexMap.get(sessionId);
    Assert.requireNonNull(mutexReference, "mutexReference");
    return mutexReference.get();
  }
}

代码示例来源:origin: dev.rico/rico-remoting-common

public void addParam(final String name, final Object value) {
    Assert.requireNonBlank(name, "name");
    params.put(name, value);
  }
}

代码示例来源:origin: dev.rico/rico-core

@Override
  public void uncaughtException(final Thread thread, final Throwable exception) {
    Assert.requireNonNull(thread, "thread");
    Assert.requireNonNull(exception, "exception");
    LOG.error("Unhandled error in background thread " + thread.getName(), exception);
  }
}

代码示例来源:origin: dev.rico/rico-remoting-server

public ServerRemotingContext getContextById(String clientSessionId) {
  Assert.requireNonBlank(clientSessionId, "clientSessionId");
  WeakReference<ServerRemotingContext> ref = weakContextMap.get(clientSessionId);
  ServerRemotingContext serverRemotingContext = ref.get();
  Assert.requireNonNull(serverRemotingContext, "serverRemotingContext");
  return serverRemotingContext;
}

代码示例来源:origin: dev.rico/rico-remoting-server

private void onDestroyController(final String controllerId) {
  Assert.requireNonBlank(controllerId, "controllerId");
  if (platformBeanRepository == null) {
    throw new IllegalStateException("An action was called before the init-command was sent.");
  }
  controllerHandler.destroyController(controllerId);
}

相关文章