We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In order to extract a series of nested properties, we need to create a complex series of calls. If we had a structure like this:
{ "a": { "objectValue": { "stringValue": "value" } } }
In order to get the value we would need to do something like this
class Example { String getValue(PropertyHoldingEntity entity) { PropertyCollection propertyCollection = entity.getProperties(); Optional<Property> subPropertyA = propertyCollection.getObjectByKey("a", Property.class); Optional<Property> valueA = subPropertyA.flatMap(p -> p.getObjectValue(Property.class)); Optional<String> stringValue = valueA.flatMap(Property::getStringValue); return stringValue.orElse(""); } }
A better solution would be to allow json style path to be mapped to it.
public interface PropertyMapper { Optional<String> getStringValue(PropertyHoldingEntity entity, String path); }
class Example { String getValue(PropertyHoldingEntity entity) { PropertyMapper propertyMapper = new PropertyMapper(); return propertyMapper.getStringValue(entity, "a.object.string").orElse(""); } }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
In order to extract a series of nested properties, we need to create a complex series of calls. If we had a structure like this:
In order to get the value we would need to do something like this
A better solution would be to allow json style path to be mapped to it.
The text was updated successfully, but these errors were encountered: