-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve property parsing (Proto-typed with the string value) #12
base: master
Are you sure you want to change the base?
Conversation
…perty objects in PropertyCollection before it is added as the objectValue, tests have also been added
return stringValue; | ||
} | ||
|
||
private boolean checkObjectValueIsAPropertyCollection(Optional<Property> property) { |
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.
Do you need to pass in an optional here? Would it make more sense to test if the optional is present in the loop and break if its not so you only need to pass in property here?
return true; | ||
} | ||
|
||
private boolean checkPropertyValueIsAString(Optional<Property> property) { |
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.
Same question on the optional
|
||
private boolean checkPropertyValueIsAString(Optional<Property> property) { | ||
if(property.isEmpty()) return false; | ||
if(!property.get().hasStringValue()) return false; |
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.
you could just do return property.get().hasStringValue();
|
||
// Checks if the objectValue is a PropertyCollection | ||
Optional<PropertyCollection> propertyCollection = property.get().getObjectValue(PropertyCollection.class); | ||
if(propertyCollection.isEmpty()) return false; |
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.
return propertyCollection.isPresent();
Optional<Property> subProperty = Optional.empty(); | ||
Optional<String> stringValue = Optional.of(""); | ||
|
||
String [] pathArray = path.split("\\."); |
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 would be worth checking if path is null before this, just in case
|
||
import java.util.Optional; | ||
|
||
public class PropertyMapper { |
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.
Can you add a java doc to explain what this does, how to use it and with your names as the @author
@BrandonAGoodwin Looks really good. I've added a few minor comments but nice work |
The property mapper has been set up to work for the getStringValue method, but can be further refactored so that extending to include other get value methods is made easy.
This also includes the new Property setter and PropertyCollection wrapper.