Skip to content

Commit efa70d6

Browse files
committed
v1.5.1: functional API and java time
1 parent 079e689 commit efa70d6

File tree

86 files changed

+2663
-1172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2663
-1172
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,24 @@ for a higher control compared to the EasyML Facade.
6060

6161
### Release Notes
6262

63+
!Release 1.5.1
64+
- feature: add functional API.
65+
- feature: add CalendarStrategy and OptionalStrategy.
66+
- feature: added java.time strategies.
67+
- performance: added caching to SerializableStrategy.
68+
- refactor: remove Profile feature.
69+
70+
6371
!Release 1.5.0
6472
- requires Java 8 or later.
6573
- NON-BACKWARD COMPATIBLE refactor of ReflectionUtil.
6674
- feature: support for Java 9 security model.
6775

6876

6977
!Release 1.4.7
70-
- last Java 7 compatible release
71-
- bugfix: performance regression in Serialization strategy
72-
- remove AccessibleObject.isAccessible calls
78+
- last Java 7 compatible release.
79+
- bugfix: performance regression in Serialization strategy.
80+
- remove AccessibleObject.isAccessible calls.
7381

7482

7583
!Release 1.4.6

easyml/src/net/sourceforge/easyml/EasyML.java

Lines changed: 176 additions & 262 deletions
Large diffs are not rendered by default.

easyml/src/net/sourceforge/easyml/EasyMLBuilder.java

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import net.sourceforge.easyml.marshalling.CompositeStrategy;
2222
import net.sourceforge.easyml.marshalling.SimpleStrategy;
23-
import net.sourceforge.easyml.marshalling.custom.NodeListStrategy;
24-
import net.sourceforge.easyml.marshalling.custom.NodeStrategy;
2523
import org.xmlpull.v1.XmlPullParser;
2624

2725
import java.lang.reflect.Field;
@@ -42,39 +40,28 @@
4240
* .withCustomRootTag("Persons")
4341
* .withAlias(Person.class, "Person")
4442
* .withAlias(Person.class, "name", "Name")
43+
* .withStrategy(PersonStrategy.INSTANCE)
44+
* .withoutStrategy(CharsStrategy.INSTANCE)
4545
* .build();
4646
* </pre> Not all possible customizations are accessible through this builder.
4747
* Hence, in some cases, one must use the {@linkplain XMLReader}s and
48-
* {@linkplain XMLWriter}s directly, for example:
49-
* <br/>
50-
* <pre>
51-
* final XMLWriter w= easyml.newWriter(new FileWriter(FILE_NAME));
52-
* w.writeInt(1);
53-
* w.writeInt(2);
54-
* w.write(obj1);
55-
* //..
56-
* w.write(objN);
57-
* w.close();
58-
* </pre>
59-
* <br/>
48+
* {@linkplain XMLWriter}s directly.
49+
*
6050
* <b>Note:</b> this builder implementation is <b>not</b> thread-safe
6151
*
6252
* @author Victor Cordis ( cordis.victor at gmail.com)
63-
* @version 1.5.0
53+
* @version 1.5.1
6454
* @see EasyML
6555
* @see XMLReader
6656
* @see XMLWriter
6757
* @since 1.4.0
6858
*/
69-
public final class EasyMLBuilder {
59+
public final class EasyMLBuilder implements Supplier<EasyML> {
7060

71-
private EasyML.Profile profile;
7261
private EasyML.Style style;
7362
private Supplier<XmlPullParser> xmlPullParserProvider;
7463
private String dateFormat;
7564
private String customRootTag;
76-
private NodeListStrategy customArrayTag;
77-
private NodeStrategy customStringTag;
7865
private Map<Class, String> classToAlias;
7966
private Map<Field, String> fieldToAlias;
8067
private Set<Field> excludedFields;
@@ -84,16 +71,6 @@ public final class EasyMLBuilder {
8471
private Set<SimpleStrategy> unregisteredSimple;
8572
private Set<CompositeStrategy> unregisteredComposite;
8673

87-
/**
88-
* Sets the EasyML profile.
89-
*
90-
* @param profile to use
91-
*/
92-
public EasyMLBuilder withProfile(EasyML.Profile profile) {
93-
this.profile = profile;
94-
return this;
95-
}
96-
9774
/**
9875
* Sets the XML outputting style.
9976
*
@@ -140,27 +117,6 @@ public EasyMLBuilder withCustomRootTag(String customRootTag) {
140117
return this;
141118
}
142119

143-
/**
144-
* Sets the given custom XML tag name for arrays.
145-
*
146-
* @param customArrayTag to be used for arrays
147-
* @param arrayType class of the array to use this custom tag
148-
*/
149-
public EasyMLBuilder withCustomArrayTag(String customArrayTag, Class arrayType) {
150-
this.customArrayTag = new NodeListStrategy(customArrayTag, arrayType);
151-
return this;
152-
}
153-
154-
/**
155-
* Sets the given custom XML tag name for strings.
156-
*
157-
* @param customStringTag to be used for strings
158-
*/
159-
public EasyMLBuilder withCustomStringTag(String customStringTag) {
160-
this.customStringTag = new NodeStrategy(customStringTag);
161-
return this;
162-
}
163-
164120
/**
165121
* Sets the given alias form the given class.
166122
*
@@ -321,13 +277,10 @@ public EasyML build() {
321277
}
322278
// build:
323279
return new EasyML(
324-
profile,
325280
style,
326281
xmlPullParserProvider,
327282
dateFormat,
328283
customRootTag,
329-
customArrayTag,
330-
customStringTag,
331284
classToAlias,
332285
fieldToAlias,
333286
excludedFields,
@@ -338,4 +291,12 @@ public EasyML build() {
338291
unregisteredComposite
339292
);
340293
}
294+
295+
/**
296+
* {@inheritDoc}
297+
*/
298+
@Override
299+
public EasyML get() {
300+
return this.build();
301+
}
341302
}

0 commit comments

Comments
 (0)