Conversation
There was a problem hiding this comment.
Why is this class required , we can directly fetch the details from the hashmap ?
There was a problem hiding this comment.
The last method of the class ensures that property is a Boolean. If fetching from a HashMap directly, the code would have to follow the fetch making it harder to read. That's why a new class was introduced.
|
|
||
| public static <T> T getProperty(HashMap<String, Object> validationProperties, String property, T defValue) { | ||
| Object object = validationProperties.get(property); | ||
| if (object == null) |
There was a problem hiding this comment.
code can be optimised as follows:
object instanceof Boolean ? (Boolean) object : defValue;
There was a problem hiding this comment.
Yes, but then I lose the error message. And it's important here as it would be difficult to investigate why default value was returned instead of value from HashMap. I tried to find how to check it dynamically (something linek 'object instance of T'), but generics are compile-time-only feature...
…emrem-semantics into validate-purls
Applicable Issues
Description of the Change
Functionality validating PURLs added.
Alternate Designs
Possible Drawbacks
Sign-off
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Roman Szturc roman.szturc.ext@ericsson.com