-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Refactor WrapperProperties template to remove caching and simplify implementation #2436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -191,11 +191,10 @@ private <T> T writeOperation(WriteOp<T> runner) { | |||||||||
| } | ||||||||||
|
|
||||||||||
| private void writeOperationVoid(WriteOpVoid runner) { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| runner.perform(props); | ||||||||||
| if (!props.equals(getter.get())) { | ||||||||||
| setter.accept(props); | ||||||||||
| } | ||||||||||
| writeOperation(properties -> { | ||||||||||
| runner.perform(properties); | ||||||||||
| return null; | ||||||||||
|
Comment on lines
+195
to
+196
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
format seems broken as offset. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use auto formatting, so either it fails or we need to accept the output. If the CI test pass, we cannot change the formatting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, thanks. |
||||||||||
| }); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
|
|
@@ -302,20 +301,17 @@ public synchronized void load(InputStream inStream) throws IOException { | |||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void save(OutputStream out, String comments) { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| props.save(out, comments); | ||||||||||
| new OrderedProperties(getter.get()).save(out, comments); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void store(Writer writer, String comments) throws IOException { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| props.store(writer, comments); | ||||||||||
| new OrderedProperties(getter.get()).store(writer, comments); | ||||||||||
gnodet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void store(OutputStream out, String comments) throws IOException { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| props.store(out, comments); | ||||||||||
| new OrderedProperties(getter.get()).store(out, comments); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
|
|
@@ -325,29 +321,23 @@ public synchronized void loadFromXML(InputStream in) throws IOException, Invalid | |||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void storeToXML(OutputStream os, String comment) throws IOException { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| props.storeToXML(os, comment); | ||||||||||
| new OrderedProperties(getter.get()).storeToXML(os, comment); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void storeToXML(OutputStream os, String comment, String encoding) throws IOException { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| props.storeToXML(os, comment, encoding); | ||||||||||
| new OrderedProperties(getter.get()).storeToXML(os, comment, encoding); | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| private Object writeReplace() throws java.io.ObjectStreamException { | ||||||||||
| OrderedProperties props = new OrderedProperties(getter.get()); | ||||||||||
| return props; | ||||||||||
| return new OrderedProperties(getter.get()); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| private class OrderedProperties extends Properties { | ||||||||||
gnodet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| private final List<Object> keyOrder = new CopyOnWriteArrayList<>(); | ||||||||||
|
|
||||||||||
| public OrderedProperties() { | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public OrderedProperties(Map<?, ?> map) { | ||||||||||
| OrderedProperties(Map<?, ?> map) { | ||||||||||
| putAll(map); | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format seems broken as offset.