dev.rico.internal.core.Assert.requireNonBlank()方法的使用及代码示例

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

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

Assert.requireNonBlank介绍

[英]Checks that the specified str blank, throws IllegalArgumentException with a customized error message if it is.
[中]检查指定的str是否为空,如果为空,则抛出带有自定义错误消息的IllegalArgumentException。

代码示例

代码示例来源: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-remoting-common

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

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

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

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

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

代码示例来源: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-core

private URLTemplate(final String urlRepresentation) {
  Assert.requireNonBlank(urlRepresentation, "urlRepresentation");
  this.urlRepresentation = urlRepresentation;
}

代码示例来源: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

/**
 * Checks that the specified condition is met and throws a customized
 * {@link IllegalStateException} if it is.
 *
 * @param condition the condition to check
 * @param message   detail message to be used in the event that a {@code
 *                  IllegalStateException} is thrown
 * @throws IllegalStateException if {@code condition} evaluates to false
 */
public static void requireState(final boolean condition, final String message) {
  if (!condition) {
    throw new IllegalStateException(requireNonBlank(message, "message"));
  }
}

代码示例来源: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-server

private void onSessionEnds(final String clientSessionId) {
  Assert.requireNonBlank(clientSessionId, "clientSessionId");
  final List<Subscription> subscriptions = sessionStore.get(clientSessionId);
  if (subscriptions != null) {
    for (Subscription subscription : subscriptions) {
      subscription.unsubscribe();
    }
  }
}

代码示例来源: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);
}

代码示例来源: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-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-server

public Mutex getMutexForHttpSession(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-client

@Override
  public <C> CompletableFuture<ControllerProxy<C>> createController(String name) {
    Assert.requireNonBlank(name, "name");

    return controllerProxyFactory.<C>create(name, controllerId).handle((ControllerProxy<C> cControllerProxy, Throwable throwable) -> {
      if (throwable != null) {
        throw new ControllerInitalizationException("Error while creating controller of type " + name, throwable);
      }
      return cControllerProxy;
    });
  }
}

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

@Override
public Object get(final String name, final ObjectFactory<?> objectFactory) {
  Assert.requireNonBlank(name, "name");
  Assert.requireNonNull(objectFactory, "objectFactory");
  Map<String, Object> localStore = getLocalStore();
  if (!localStore.containsKey(name)) {
    localStore.put(name, objectFactory.getObject());
  }
  return localStore.get(name);
}

代码示例来源: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-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-server

private void onCreateController(final String controllerName, final String parentControllerId) {
  Assert.requireNonBlank(controllerName, "controllerName");
  if (platformBeanRepository == null) {
    throw new IllegalStateException("An action was called before the init-command was sent.");
  }
  final InternalAttributesBean bean = platformBeanRepository.getInternalAttributesBean();
  final String controllerId = controllerHandler.createController(controllerName, parentControllerId);
  bean.setControllerId(controllerId);
  Object model = controllerHandler.getControllerModel(controllerId);
  if (model != null) {
    bean.setModel(model);
  }
}

相关文章