Skip to content
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

Created module with converter and configuration source for YAML #35

Merged
merged 4 commits into from
Jan 16, 2018

Conversation

sobolewskikamil
Copy link
Collaborator

No description provided.

Copy link
Contributor

@grzegorzt grzegorzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the changes looks good but some improvements are necessary.

JavaDoc should be provided, user's guide updated. I'm not sure about performance implications. Could you check if creating snake yaml serializer in the converter every time is fast enough or some pool of objects is necessary.

import java.util.Iterator;
import java.util.Map;

public class MapIterable implements Iterable<ConfigurationEntry> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide javadoc for this class?


@Override
public Iterator<ConfigurationEntry> iterator() {
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think statically importing Map.Entry will make a code a bit more readable.

private final Map<String, String> map;

public MapIterable(Map<String, String> map) {
this.map = map;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add Objects.requireNonNull() to make sure the object is not created with null map.

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

// todo javadoc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation is required for this annotation and it should show example usage.

import static java.util.Collections.singletonMap;
import static java.util.Objects.requireNonNull;

public class YamlConfigurationSource implements IterableConfigurationSource {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide javadoc for this class?

requireNonNull(inputStream, "inputStream cannot be null");

Reader reader = new UnicodeReader(inputStream);
this.properties = createProperties(reader);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be inside try to make sure input stream is always closed properly.

Reader reader = new UnicodeReader(inputStream);
this.properties = createProperties(reader);
try {
reader.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure both reader and stream must be closed?

@CLAassistant
Copy link

CLAassistant commented Jan 16, 2018

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@grzegorzt grzegorzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thanks for contribution very much.

@grzegorzt grzegorzt merged commit 25667eb into SabreOSS:master Jan 16, 2018
@sobolewskikamil sobolewskikamil deleted the yaml-module branch January 16, 2018 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants