@Test public void isEmpty_EmptyText() { ctx.currentResource("/content/empty-text"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertTrue(metadata.isEmpty()); }
@Override public boolean isEmpty() { if (StringUtils.isBlank(getPropertyName())) { return true; } else { Object val = combinedProperties.get(getPropertyName()); if (val == null) { return true; } else if (val instanceof String) { return StringUtils.isBlank((String) val); } else if (val instanceof String[]) { return ArrayUtils.isEmpty((String[]) val) || !Arrays.stream((String[]) val).filter(StringUtils::isNotBlank).findFirst().isPresent(); } else if (val instanceof Object[]) { return ArrayUtils.isEmpty((Object[]) val); } else if (val instanceof Collection) { return ((Collection) val).isEmpty(); } else { return false; } } }
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public boolean isEmpty() { if (StringUtils.isBlank(getPropertyName())) { return true; } else { Object val = combinedProperties.get(getPropertyName()); if (val == null) { return true; } else if (val instanceof String) { return StringUtils.isBlank((String) val); } else if (val instanceof String[]) { return ArrayUtils.isEmpty((String[]) val) || !Arrays.stream((String[]) val).filter(StringUtils::isNotBlank).findFirst().isPresent(); } else if (val instanceof Object[]) { return ArrayUtils.isEmpty((Object[]) val); } else if (val instanceof Collection) { return ((Collection) val).isEmpty(); } else { return false; } } } }
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public boolean isEmpty() { if (StringUtils.isBlank(getPropertyName())) { return true; } else { Object val = combinedProperties.get(getPropertyName()); if (val == null) { return true; } else if (val instanceof String) { return StringUtils.isBlank((String) val); } else if (val instanceof String[]) { return ArrayUtils.isEmpty((String[]) val) || !Arrays.stream((String[]) val).filter(StringUtils::isNotBlank).findFirst().isPresent(); } else if (val instanceof Object[]) { return ArrayUtils.isEmpty((Object[]) val); } else if (val instanceof Collection) { return ((Collection) val).isEmpty(); } else { return false; } } }  }
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public boolean isEmpty() { if (StringUtils.isBlank(getPropertyName())) { return true; } else { Object val = combinedProperties.get(getPropertyName()); if (val == null) { return true; } else if (val instanceof String) { return StringUtils.isBlank((String) val); } else if (val instanceof String[]) { return ArrayUtils.isEmpty((String[]) val) || !Arrays.stream((String[]) val).filter(StringUtils::isNotBlank).findFirst().isPresent(); } else if (val instanceof Object[]) { return ArrayUtils.isEmpty((Object[]) val); } else if (val instanceof Collection) { return ((Collection) val).isEmpty(); } else { return false; } } }  @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Override String getFormat(); @Override ValueMap getProperties(); @Override AssetModel getAsset(); @Override String getPropertyName(); @Override boolean isEmpty(); @Override boolean isReady(); @Nonnull @Override String getExportedType(); }
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public boolean isEmpty() { if (StringUtils.isBlank(getPropertyName())) { return true; } else { Object val = combinedProperties.get(getPropertyName()); if (val == null) { return true; } else if (val instanceof String) { return StringUtils.isBlank((String) val); } else if (val instanceof String[]) { return ArrayUtils.isEmpty((String[]) val) || !Arrays.stream((String[]) val).filter(StringUtils::isNotBlank).findFirst().isPresent(); } else if (val instanceof Object[]) { return ArrayUtils.isEmpty((Object[]) val); } else if (val instanceof Collection) { return ((Collection) val).isEmpty(); } else { return false; } } }  @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Override String getFormat(); @Override ValueMap getProperties(); @Override AssetModel getAsset(); @Override String getPropertyName(); @Override boolean isEmpty(); @Override boolean isReady(); @Nonnull @Override String getExportedType();  }