org.unipop.schema.property.ParentSchemaProperty Maven / Gradle / Ivy
package org.unipop.schema.property;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created by sbarzilay on 8/2/16.
*/
public interface ParentSchemaProperty extends PropertySchema{
Collection getChildren();
default Set excludeDynamicFields() {
return getChildren().stream()
.map(PropertySchema::excludeDynamicFields)
.flatMap(Collection::stream).collect(Collectors.toSet());
}
default Set toFields(Set propertyKeys) {
return getChildren().stream().flatMap(s -> s.toFields(propertyKeys).stream()).collect(Collectors.toSet());
}
default Map toFields(Map properties){
return Collections.emptyMap();
}
}