-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support multi-member annotations. #89
Conversation
@@ -57,6 +57,16 @@ public Appendable write(Appendable appendable, Context context) throws IOExcepti | |||
appendable.append(onlyEntry.getKey()).append(" = "); | |||
} | |||
onlyEntry.getValue().write(appendable, context); | |||
} else { | |||
boolean first = true; |
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.
As a simpler alternative:
String sep = "";
for (Entry<String, Writable> entry : memberMap.entrySet()) {
appendable.append(sep).append(entry.getKey()).append(" = ");
entry.getValue().write(appendable, context);
sep = ", ";
}
498c53a
to
5b0ae5f
Compare
import java.util.Set; | ||
|
||
/** A context which always returns fully-qualified type names. */ | ||
final class EmptyContext implements Writable.Context { |
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.
There's an equivalent such context in Writeables; maybe there can be reuse here?
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.
It works for this case, but I don't think it will work for a larger-scope testing strategy where we want to verify the actual output due to its createSubcontext
behavior (throwing exception).
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.
What I meant is EmptyContext
(with its createSubcontext()
could be moved out of src/test
and used in Writeables
.
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.
Ah, I see. Yeah you're right. For now I'll switch. When we start testing more we'll know what to change.
5b0ae5f
to
1bf20dd
Compare
Support multi-member annotations.
Fixes #76.