public void fromJSONObject()

in src/main/java/org/apache/sling/feature/extension/apiregions/api/artifacts/ArtifactRules.java [183:211]


    public void fromJSONObject(final JsonObject jsonObj) throws IOException {
        super.fromJSONObject(jsonObj);
        try {
			final String modeVal = this.getString(InternalConstants.KEY_MODE);
			if ( modeVal != null ) {
                this.setMode(Mode.valueOf(modeVal.toUpperCase()));
			}

            JsonValue val = this.getAttributes().remove(InternalConstants.KEY_BUNDLE_VERSION_RULES);
            if ( val != null ) {
                for(final JsonValue innerVal : val.asJsonArray()) {
                    final VersionRule rule = new VersionRule();
                    rule.fromJSONObject(innerVal.asJsonObject());
                    this.getBundleVersionRules().add(rule);
                }
            }

            val = this.getAttributes().remove(InternalConstants.KEY_ARTIFACT_VERSION_RULES);
            if ( val != null ) {
                for(final JsonValue innerVal : val.asJsonArray()) {
                    final VersionRule rule = new VersionRule();
                    rule.fromJSONObject(innerVal.asJsonObject());
                    this.getArtifactVersionRules().add(rule);
                }
            }
        } catch (final JsonException | IllegalArgumentException e) {
            throw new IOException(e);
        }
    }