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

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

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

Assert.isBlank介绍

[英]Determines whether a given string is null, empty, or only contains whitespace. If it contains anything other than whitespace then the string is not considered to be blank and the method returns false.
[中]确定给定字符串是null、为空还是仅包含空格。如果它包含除空格以外的任何内容,则该字符串不被视为空白,并且该方法返回false

代码示例

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

public ModelStoreListenerWrapper(String presentationModelType, ModelStoreListener<A, P> delegate) {
  this.presentationModelType = !Assert.isBlank(presentationModelType) ? presentationModelType : ANY_PRESENTATION_MODEL_TYPE;
  this.delegate = delegate;
}

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

/**
 * Finds all presentation models that share the same type.<br/>
 * The returned {@code List} is never null (though it may be empty), and is immutable.
 *
 * @param type the type to search for
 * @return a {@code List} of all presentation models with the specified type.
 */
public List<P> findAllPresentationModelsByType(String type) {
  if (Assert.isBlank(type) || !modelsPerType.containsKey(type)) return Collections.emptyList();
  return Collections.unmodifiableList(modelsPerType.get(type));
}

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

protected void addAttributeByQualifier(A attribute) {
  if (null == attribute) return;
  String qualifier = attribute.getQualifier();
  if (Assert.isBlank(qualifier)) return;
  List<A> list = attributesPerQualifier.get(qualifier);
  if (null == list) {
    list = new ArrayList<A>();
    attributesPerQualifier.put(qualifier, list);
  }
  if (!list.contains(attribute)) list.add(attribute);
}

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

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

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

protected void addPresentationModelByType(P model) {
  if (null == model) return;
  String type = model.getPresentationModelType();
  if (Assert.isBlank(type)) return;
  List<P> list = modelsPerType.get(type);
  if (null == list) {
    list = new ArrayList<P>();
    modelsPerType.put(type, list);
  }
  if (!list.contains(model)) list.add(model);
}

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

/**
 * Convenience method to let Dolphin delete a presentation model on the client side
 */
@Deprecated
public static void deleteCommand(final List<Command> response, final String pmId) {
  if (response == null || Assert.isBlank(pmId)) {
    return;
  }
  response.add(new DeletePresentationModelCommand(pmId));
}

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

/**
 * Checks that the specified {@code str} {@code blank}, throws {@link IllegalArgumentException} with a customized error message if it is.
 *
 * @param str          the value to be checked.
 * @param argumentName the name of the argument to be used in the error message.
 * @return the {@code str}.
 * @throws java.lang.NullPointerException     if {@code str} is null.
 * @throws java.lang.IllegalArgumentException if {@code str} is blank.
 * @see #requireNonNull(Object, String)
 * @see #isBlank(String)
 */
public static String requireNonBlank(final String str, final String argumentName) {
  requireNonNull(str, argumentName);
  if (isBlank(str)) {
    throw new IllegalArgumentException(String.format(NOT_EMPTY_MSG_FORMAT, argumentName));
  }
  return str;
}

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

/**
 * Adds a presentation model to this store.<br/>
 * Presentation model ids should be unique. This method guarantees this condition by disallowing
 * models with duplicate ids to be added.
 *
 * @param model the model to be added.
 * @return if the add operation was successful or not.
 * @throws IllegalArgumentException if a presentation model with the model's ID is already in the model store.
 */
public boolean add(P model) {
  if (null == model) return false;
  if (presentationModels.containsKey(model.getId())) {
    throw new IllegalArgumentException("There already is a PM with id " + model.getId());
  }
  boolean added = false;
  if (!presentationModels.containsValue(model)) {
    presentationModels.put(model.getId(), model);
    addPresentationModelByType(model);
    for (A attribute : model.getAttributes()) {
      addAttributeById(attribute);
      attribute.addPropertyChangeListener(Attribute.QUALIFIER_NAME, ATTRIBUTE_WORKER);
      if (!Assert.isBlank(attribute.getQualifier())) addAttributeByQualifier(attribute);
    }
    fireModelStoreChangedEvent(model, ModelStoreEvent.Type.ADDED);
    added = true;
  }
  return added;
}

相关文章