/** * Creates a new ImmutableEnforcement instance. * * @param input input the string to match against filters. * @param filters filters to match against the input . * @return new ImmutableEnforcement instance */ static ImmutableEnforcement of(final String input, final Set<String> filters) { return new ImmutableEnforcement(input, filters); }
/** * New instance of {@link Enforcement} options. * * @param input the input that is compared against the filters * @param filters additional filters * @return the enforcement instance */ public static Enforcement newEnforcement(final String input, final Set<String> filters) { return ImmutableEnforcement.of(input, filters); }
/** * Creates a new ImmutableEnforcement instance. * * @param input input the string to match against filters. * @param filters filters to match against the input . * @return new ImmutableEnforcement instance */ static ImmutableEnforcement of(final String input, final Set<String> filters) { return new ImmutableEnforcement(input, filters); }
/** * New instance of {@link Enforcement} options. * * @param input the input that is compared against the filters * @param filters additional filters * @return the enforcement instance */ public static Enforcement newEnforcement(final String input, final Set<String> filters) { return ImmutableEnforcement.of(input, filters); }
/** * Creates a new {@code Enforcement} object from the specified JSON object. * * @param jsonObject a JSON object which provides the data for the Enforcement to be created. * @return a new Enforcement which is initialised with the extracted data from {@code jsonObject}. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonObject} is not an appropriate JSON object. */ public static Enforcement fromJson(final JsonObject jsonObject) { final Set<String> readFilters = jsonObject.getValue(JsonFields.FILTERS) .map(array -> array.stream() .map(JsonValue::asString) .collect(Collectors.toSet())).orElse(Collections.emptySet()); final String readInput = jsonObject.getValueOrThrow(JsonFields.INPUT); return new ImmutableEnforcement(readInput, readFilters); }
/** * Create a copy of this object with error message set. * * @param enforcement the enforcement options * @return a copy of this object. */ public static Enforcement newEnforcement(final Enforcement enforcement) { return ImmutableEnforcement.of(enforcement.getInput(), enforcement.getFilters()); }
/** * Creates a new {@code Enforcement} object from the specified JSON object. * * @param jsonObject a JSON object which provides the data for the Enforcement to be created. * @return a new Enforcement which is initialised with the extracted data from {@code jsonObject}. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonObject} is not an appropriate JSON object. */ public static Enforcement fromJson(final JsonObject jsonObject) { final Set<String> readFilters = jsonObject.getValue(JsonFields.FILTERS) .map(array -> array.stream() .map(JsonValue::asString) .collect(Collectors.toSet())).orElse(Collections.emptySet()); final String readInput = jsonObject.getValueOrThrow(JsonFields.INPUT); return new ImmutableEnforcement(readInput, readFilters); }
/** * Create a copy of this object with error message set. * * @param enforcement the enforcement options * @return a copy of this object. */ public static Enforcement newEnforcement(final Enforcement enforcement) { return ImmutableEnforcement.of(enforcement.getInput(), enforcement.getFilters()); }