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

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

本文整理了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

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

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

  1. protected void removeAttributeByQualifier(A attribute, String qualifier) {
  2. if (Assert.isBlank(qualifier)) return;
  3. List<A> list = attributesPerQualifier.get(qualifier);
  4. if (null == list) return;
  5. list.remove(attribute);
  6. if (list.isEmpty()) {
  7. attributesPerQualifier.remove(qualifier);
  8. }
  9. }

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

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

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

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

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

  1. protected void removePresentationModelByType(P model) {
  2. if (null == model) return;
  3. String type = model.getPresentationModelType();
  4. if (Assert.isBlank(type)) return;
  5. List<P> list = modelsPerType.get(type);
  6. if (null == list) return;
  7. list.remove(model);
  8. if (list.isEmpty()) {
  9. modelsPerType.remove(type);
  10. }
  11. }

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

  1. protected void addAttributeByQualifier(A attribute) {
  2. if (null == attribute) return;
  3. String qualifier = attribute.getQualifier();
  4. if (Assert.isBlank(qualifier)) return;
  5. List<A> list = attributesPerQualifier.get(qualifier);
  6. if (null == list) {
  7. list = new ArrayList<A>();
  8. attributesPerQualifier.put(qualifier, list);
  9. }
  10. if (!list.contains(attribute)) list.add(attribute);
  11. }

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

  1. protected void removeAttributeByQualifier(A attribute) {
  2. if (null == attribute) return;
  3. String qualifier = attribute.getQualifier();
  4. if (Assert.isBlank(qualifier)) return;
  5. List<A> list = attributesPerQualifier.get(qualifier);
  6. if (null != list) {
  7. list.remove(attribute);
  8. }
  9. }

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

  1. protected void addPresentationModelByType(P model) {
  2. if (null == model) return;
  3. String type = model.getPresentationModelType();
  4. if (Assert.isBlank(type)) return;
  5. List<P> list = modelsPerType.get(type);
  6. if (null == list) {
  7. list = new ArrayList<P>();
  8. modelsPerType.put(type, list);
  9. }
  10. if (!list.contains(model)) list.add(model);
  11. }

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

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

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

  1. /**
  2. * Checks that the specified {@code str} {@code blank}, throws {@link IllegalArgumentException} with a customized error message if it is.
  3. *
  4. * @param str the value to be checked.
  5. * @param argumentName the name of the argument to be used in the error message.
  6. * @return the {@code str}.
  7. * @throws java.lang.NullPointerException if {@code str} is null.
  8. * @throws java.lang.IllegalArgumentException if {@code str} is blank.
  9. * @see #requireNonNull(Object, String)
  10. * @see #isBlank(String)
  11. */
  12. public static String requireNonBlank(final String str, final String argumentName) {
  13. requireNonNull(str, argumentName);
  14. if (isBlank(str)) {
  15. throw new IllegalArgumentException(String.format(NOT_EMPTY_MSG_FORMAT, argumentName));
  16. }
  17. return str;
  18. }

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

  1. /**
  2. * Adds a presentation model to this store.<br/>
  3. * Presentation model ids should be unique. This method guarantees this condition by disallowing
  4. * models with duplicate ids to be added.
  5. *
  6. * @param model the model to be added.
  7. * @return if the add operation was successful or not.
  8. * @throws IllegalArgumentException if a presentation model with the model's ID is already in the model store.
  9. */
  10. public boolean add(P model) {
  11. if (null == model) return false;
  12. if (presentationModels.containsKey(model.getId())) {
  13. throw new IllegalArgumentException("There already is a PM with id " + model.getId());
  14. }
  15. boolean added = false;
  16. if (!presentationModels.containsValue(model)) {
  17. presentationModels.put(model.getId(), model);
  18. addPresentationModelByType(model);
  19. for (A attribute : model.getAttributes()) {
  20. addAttributeById(attribute);
  21. attribute.addPropertyChangeListener(Attribute.QUALIFIER_NAME, ATTRIBUTE_WORKER);
  22. if (!Assert.isBlank(attribute.getQualifier())) addAttributeByQualifier(attribute);
  23. }
  24. fireModelStoreChangedEvent(model, ModelStoreEvent.Type.ADDED);
  25. added = true;
  26. }
  27. return added;
  28. }

相关文章