Skip to content

Commit 8dd2bb4

Browse files
committed
🎨 use Java 8 features
iterate using for earch use lambda expression (consumer) use ifPresent to avoid nullpointer exception (java.util.Optional)
1 parent 806815f commit 8dd2bb4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/io/asfjava/ui/core/schema/CustomStringSchema.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ class CustomStringSchema extends StringSchema {
1313
public void enrichWithBeanProperty(BeanProperty beanProperty) {
1414
super.enrichWithBeanProperty(beanProperty);
1515
Iterable<Annotation> it = beanProperty.getMember().annotations();
16-
String anno = it.iterator().next().annotationType().getName();
17-
SchemaDecoratorFactory.getInstance().getDecorator(anno).customizeSchema(beanProperty, this);
16+
it.forEach(
17+
annotation -> SchemaDecoratorFactory.getInstance().getDecorator(annotation.annotationType().getName())
18+
.ifPresent(decorator -> decorator.customizeSchema(beanProperty, this)));
1819
}
1920

2021
}

0 commit comments

Comments
 (0)