Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 012fc86

Browse files
fakhreddinefakhreddine
fakhreddine
authored and
fakhreddine
committed
edit the CustomStringSchema in order to ietrate on annotations
1 parent 89ac4ce commit 012fc86

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed
Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,21 @@
11
package io.asfjava.ui.core.schema;
22

3+
import java.lang.annotation.Annotation;
4+
35
import com.fasterxml.jackson.databind.BeanProperty;
46
import com.fasterxml.jackson.module.jsonSchema.types.StringSchema;
57

68
import io.asfjava.ui.core.SchemaDecoratorFactory;
7-
import io.asfjava.ui.core.form.CheckBox;
8-
import io.asfjava.ui.core.form.ComboBox;
9-
import io.asfjava.ui.core.form.Password;
10-
import io.asfjava.ui.core.form.RadioBox;
11-
import io.asfjava.ui.core.form.TextArea;
12-
import io.asfjava.ui.core.form.TextField;
139

1410
class CustomStringSchema extends StringSchema {
1511

1612
@Override
1713
public void enrichWithBeanProperty(BeanProperty beanProperty) {
18-
super.enrichWithBeanProperty(beanProperty);
19-
if (beanProperty.getAnnotation(TextField.class) != null) {
20-
SchemaDecoratorFactory.getInstance().getGenerator(TextField.class.getName()).customizeSchema(beanProperty,
21-
this);
22-
}
23-
if (beanProperty.getAnnotation(ComboBox.class) != null) {
24-
SchemaDecoratorFactory.getInstance().getGenerator(ComboBox.class.getName()).customizeSchema(beanProperty,
25-
this);
26-
}
27-
if (beanProperty.getAnnotation(CheckBox.class) != null) {
28-
SchemaDecoratorFactory.getInstance().getGenerator(CheckBox.class.getName()).customizeSchema(beanProperty,
29-
this);
30-
}
31-
if (beanProperty.getAnnotation(RadioBox.class) != null) {
32-
SchemaDecoratorFactory.getInstance().getGenerator(RadioBox.class.getName()).customizeSchema(beanProperty,
33-
this);
34-
}
35-
if (beanProperty.getAnnotation(TextArea.class) != null) {
36-
SchemaDecoratorFactory.getInstance().getGenerator(TextArea.class.getName()).customizeSchema(beanProperty,
37-
this);
38-
}
39-
if (beanProperty.getAnnotation(Password.class) != null) {
40-
SchemaDecoratorFactory.getInstance().getGenerator(TextField.class.getName()).customizeSchema(beanProperty,
41-
this);
42-
}
14+
super.enrichWithBeanProperty(beanProperty);
15+
Iterable<Annotation> it = beanProperty.getMember().annotations();
16+
String anno = it.iterator().next().annotationType().getName();
17+
SchemaDecoratorFactory.getInstance().getGenerator(anno).customizeSchema(beanProperty, this);
18+
4319
}
4420

4521
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /