Skip to content

Conversation

@dmytro-kashcheiev
Copy link
Collaborator

No description provided.

@codecov-io
Copy link

codecov-io commented Oct 6, 2016

Current coverage is 78.15% (diff: 96.96%)

Merging #190 into master will increase coverage by 0.04%

@@             master       #190   diff @@
==========================================
  Files           130        132     +2   
  Lines          4709       4733    +24   
  Methods           0          0          
  Messages          0          0          
  Branches        518        521     +3   
==========================================
+ Hits           3678       3699    +21   
- Misses          937        939     +2   
- Partials         94         95     +1   

Powered by Codecov. Last update d3a3e86...b934d1a

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

Please see my comments. Some minor changes are required.

* @author Dmitry Kashcheiev
*/
/* package */ class BooleanFieldValidator extends FieldValidator<Boolean> {

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove excessive empty line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


@Override
protected boolean isValueNotSet(Boolean value) {
// Boolean field can't be determined if it set or not, because protobuf 'false' value and 'no value' are the same
Copy link
Contributor

Choose a reason for hiding this comment

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

A Javadoc would be more appropriate here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@Override
protected boolean isValueNotSet(Boolean value) {
// Boolean field can't be determined if it set or not, because protobuf 'false' value and 'no value' are the same
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please test this. Do you have a Codecov browser plug-in installed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


@Override
protected boolean isValueNotSet(Descriptors.EnumValueDescriptor value) {
return value.getNumber() == 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Have final boolean result field immediately before return. This way it's easier to debug, when needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added final boolean result also updated for other files to look the same

final List<ConstraintViolation> violations = super.validate();
return violations;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need an empty line here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

/**
* Returns {@code true} if the field has required attribute or validation is strict.
*/
protected boolean isRequiredField() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please have result variable here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

/**
* Boolean field can't be determined if it set or not, because protobuf 'false' value and 'no value' are the same
Copy link
Contributor

Choose a reason for hiding this comment

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

Please have dot at the end of the sentence. While we are here, I'd say that it would be better to say that
”In Protobuf there is no way to tell if the value is {@code false} or was not set.”

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

Please change the Javadoc per my recent comment. In the rest LGTM.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

LGTM

@dmytro-kashcheiev dmytro-kashcheiev merged commit f753879 into master Oct 12, 2016
@armiol armiol deleted the vallidators-enum-boolean branch October 17, 2016 15:53
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.

4 participants