Skip to content

Commit 9fb5703

Browse files
committed
rename annotation to follow convention with _
1 parent 26a6772 commit 9fb5703

14 files changed

+40
-48
lines changed

src/main/java/org/globsframework/xml/GlobModelInit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import org.globsframework.core.metamodel.GlobModel;
44
import org.globsframework.core.metamodel.impl.DefaultGlobModel;
5-
import org.globsframework.xml.custom._XmlAsNode;
5+
import org.globsframework.xml.custom.XmlAsNode;
66

77
public class GlobModelInit {
8-
public static GlobModel MODEL = new DefaultGlobModel(_XmlAsNode.TYPE);
8+
public static GlobModel MODEL = new DefaultGlobModel(XmlAsNode.TYPE);
99
}

src/main/java/org/globsframework/xml/custom/AllAnnotations.java

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.globsframework.xml.custom;
2+
3+
import org.globsframework.core.metamodel.GlobModel;
4+
import org.globsframework.core.metamodel.impl.DefaultGlobModel;
5+
6+
public class AllXmlAnnotations {
7+
public static GlobModel MODEL = new DefaultGlobModel(XmlAsNode.TYPE, XmlValueAsCData.TYPE, XmlNS.TYPE,
8+
XmlValue.TYPE, XmlExportDateFormat.TYPE, XmlUseParentNS.TYPE);
9+
}

src/main/java/org/globsframework/xml/custom/ModelAnnotations.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/java/org/globsframework/xml/custom/_XmlAsNode.java renamed to src/main/java/org/globsframework/xml/custom/XmlAsNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.globsframework.core.model.MutableGlob;
1111
import org.globsframework.core.utils.Strings;
1212

13-
public class _XmlAsNode {
13+
public class XmlAsNode {
1414
public static GlobType TYPE;
1515

1616
public static StringField NAME;
@@ -21,7 +21,7 @@ public class _XmlAsNode {
2121
public static Key UNIQUE_KEY;
2222

2323
static {
24-
GlobTypeLoaderFactory.create(_XmlAsNode.class, "_XmlAsNode")
24+
GlobTypeLoaderFactory.create(XmlAsNode.class, "_XmlAsNode")
2525
.register(GlobCreateFromAnnotation.class, annotation -> create((XmlNode_) annotation))
2626
.load();
2727
}

src/main/java/org/globsframework/xml/custom/_XmlExportDateFormat.java renamed to src/main/java/org/globsframework/xml/custom/XmlExportDateFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.globsframework.core.metamodel.fields.StringField;
88
import org.globsframework.core.model.Key;
99

10-
public class _XmlExportDateFormat {
10+
public class XmlExportDateFormat {
1111
public static GlobType TYPE;
1212

1313
public static StringField FORMAT;
@@ -18,7 +18,7 @@ public class _XmlExportDateFormat {
1818
public static Key UNIQUE_KEY;
1919

2020
static {
21-
GlobTypeLoaderFactory.create(_XmlExportDateFormat.class, "XmlExportDateFormat")
21+
GlobTypeLoaderFactory.create(XmlExportDateFormat.class, "XmlExportDateFormat")
2222
.register(GlobCreateFromAnnotation.class, annotation -> TYPE.instantiate()
2323
.set(FORMAT, ((XmlExportDateFormat_) annotation).value())
2424
.set(ZONE_ID, ((XmlExportDateFormat_) annotation).zoneId())

src/main/java/org/globsframework/xml/custom/XmlExportDateFormat_.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

1818
String zoneId() default "";
1919

20-
GlobType TYPE = _XmlExportDateFormat.TYPE;
20+
GlobType TYPE = XmlExportDateFormat.TYPE;
2121

2222
}

src/main/java/org/globsframework/xml/custom/XmlGlobBuilder.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ public void visitInteger(IntegerField field, Integer value) throws Exception {
105105
}
106106

107107
private void dumpSimpleValue(Field field, String strValue) throws IOException {
108-
if (field.hasAnnotation(_XmlAsNode.UNIQUE_KEY)) {
109-
if (strValue != null || field.getAnnotation(_XmlAsNode.UNIQUE_KEY).isTrue(_XmlAsNode.MANDATORY)) {
108+
if (field.hasAnnotation(XmlAsNode.UNIQUE_KEY)) {
109+
if (strValue != null || field.getAnnotation(XmlAsNode.UNIQUE_KEY).isTrue(XmlAsNode.MANDATORY)) {
110110
xmlTag = xmlTag.createChildTag(ns.element().addToTag(XmlGlobWriter.getXmlName(field)));
111111
if (strValue != null) {
112-
if (field.hasAnnotation(_XmlValueAsCData.UNIQUE_KEY)) {
112+
if (field.hasAnnotation(XmlValueAsCData.UNIQUE_KEY)) {
113113
xmlTag.addCDataValue(strValue);
114114
} else {
115115
xmlTag.addValue(strValue);
116116
}
117117
}
118118
xmlTag = xmlTag.end();
119119
}
120-
} else if (field.hasAnnotation(_XmlValue.UNIQUE_KEY)) {
120+
} else if (field.hasAnnotation(XmlValue.UNIQUE_KEY)) {
121121
xmlTag.addValue(strValue);
122122
} else {
123123
if (strValue != null) {
@@ -140,9 +140,9 @@ public void visitBoolean(BooleanField field, Boolean value) throws Exception {
140140

141141
public void visitDate(DateField field, LocalDate value) throws Exception {
142142
DateTimeFormatter dateTimeFormatter;
143-
if (field.hasAnnotation(_XmlExportDateFormat.UNIQUE_KEY)) {
144-
Glob annotation = field.getAnnotation(_XmlExportDateFormat.UNIQUE_KEY);
145-
dateTimeFormatter = DateTimeFormatter.ofPattern(annotation.get(_XmlExportDateFormat.FORMAT));
143+
if (field.hasAnnotation(XmlExportDateFormat.UNIQUE_KEY)) {
144+
Glob annotation = field.getAnnotation(XmlExportDateFormat.UNIQUE_KEY);
145+
dateTimeFormatter = DateTimeFormatter.ofPattern(annotation.get(XmlExportDateFormat.FORMAT));
146146
} else {
147147
dateTimeFormatter = DateTimeFormatter.ISO_DATE;
148148
}
@@ -151,9 +151,9 @@ public void visitDate(DateField field, LocalDate value) throws Exception {
151151

152152
public void visitDateTime(DateTimeField field, ZonedDateTime value) throws Exception {
153153
DateTimeFormatter dateTimeFormatter;
154-
if (field.hasAnnotation(_XmlExportDateFormat.UNIQUE_KEY)) {
155-
Glob annotation = field.getAnnotation(_XmlExportDateFormat.UNIQUE_KEY);
156-
dateTimeFormatter = DateTimeFormatter.ofPattern(annotation.get(_XmlExportDateFormat.FORMAT));
154+
if (field.hasAnnotation(XmlExportDateFormat.UNIQUE_KEY)) {
155+
Glob annotation = field.getAnnotation(XmlExportDateFormat.UNIQUE_KEY);
156+
dateTimeFormatter = DateTimeFormatter.ofPattern(annotation.get(XmlExportDateFormat.FORMAT));
157157
} else {
158158
dateTimeFormatter = DateTimeFormatter.ISO_DATE_TIME;
159159
}

src/main/java/org/globsframework/xml/custom/XmlGlobReader.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ static class DateConverter implements UpdateFromStr {
286286

287287
DateConverter(DateField field) {
288288
this.field = field;
289-
Glob dataFormat = field.findAnnotation(_XmlExportDateFormat.UNIQUE_KEY);
289+
Glob dataFormat = field.findAnnotation(XmlExportDateFormat.UNIQUE_KEY);
290290
if (dataFormat != null) {
291-
String s = dataFormat.get(_XmlExportDateFormat.FORMAT);
291+
String s = dataFormat.get(XmlExportDateFormat.FORMAT);
292292
dateTimeFormatter = DateTimeFormatter.ofPattern(s);
293293
} else {
294294
dateTimeFormatter = DateTimeFormatter.ISO_DATE;
@@ -322,10 +322,10 @@ static class DateTimeConverter implements UpdateFromStr {
322322

323323
DateTimeConverter(DateTimeField field) {
324324
this.field = field;
325-
Glob dataFormat = field.findAnnotation(_XmlExportDateFormat.UNIQUE_KEY);
325+
Glob dataFormat = field.findAnnotation(XmlExportDateFormat.UNIQUE_KEY);
326326
if (dataFormat != null) {
327-
String s = dataFormat.get(_XmlExportDateFormat.FORMAT);
328-
zoneId = ZoneId.of(dataFormat.get(_XmlExportDateFormat.ZONE_ID, ZoneId.systemDefault().getId()));
327+
String s = dataFormat.get(XmlExportDateFormat.FORMAT);
328+
zoneId = ZoneId.of(dataFormat.get(XmlExportDateFormat.ZONE_ID, ZoneId.systemDefault().getId()));
329329
dateTimeFormatter = DateTimeFormatter.ofPattern(s).withZone(zoneId);
330330
} else {
331331
zoneId = ZoneId.systemDefault();
@@ -374,9 +374,9 @@ public GlobTypXmlNodeModel(GlobType globType, GlobTypeXmlNodeModelService nodeMo
374374
this.globType = globType;
375375
for (Field field : globType.getFields()) {
376376
String xmlName = XmlGlobWriter.getXmlName(field);
377-
if (field.hasAnnotation(_XmlAsNode.UNIQUE_KEY) || !field.getDataType().isPrimive()) {
377+
if (field.hasAnnotation(XmlAsNode.UNIQUE_KEY) || !field.getDataType().isPrimive()) {
378378
fieldAsNode.put(xmlName, field.safeAccept(new FieldModelVisitor(this.nodeModelService)).manageFieldNode);
379-
} else if (field.hasAnnotation(_XmlValue.UNIQUE_KEY)) {
379+
} else if (field.hasAnnotation(XmlValue.UNIQUE_KEY)) {
380380
valueUpdated = field.safeAccept(new ConvertFieldAsAttrVisitor()).updateFromStr;
381381
} else {
382382
fieldAsAttribute.add(field.safeAccept(new ManagedFieldAsAttrVisitor(xmlName)).manageFieldAttr);

src/main/java/org/globsframework/xml/custom/XmlNode_.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
boolean mandatory() default false;
1818

19-
GlobType TYPE = _XmlAsNode.TYPE;
19+
GlobType TYPE = XmlAsNode.TYPE;
2020

2121
}

0 commit comments

Comments
 (0)