class GrainsJsonPropertyUtil {

    public static Set<String> getPropertySet(JsonNode grainsProperty) {
        return Optional.ofNullable(grainsProperty)
                .map(JsonNode::elements)
                .map(IteratorUtils::toList)
                .map(jsonNodeList -> (Set<String>) jsonNodeList.stream()
                        .map(item -> ((JsonNode) item).asText())
                        .collect(Collectors.toSet())
                ).orElse(Collections.emptySet());
    }

    private  GrainsJsonPropertyUtil();

}