private static <S> void deserializeProperties( ArtifactProperties<S> artifactProperties, ArtifactPropertiesState propertiesState) { final Element options = propertiesState.getOptions(); if (artifactProperties == null || options == null) { return; } final S state = artifactProperties.getState(); if (state != null) { XmlSerializer.deserializeInto(state, options); artifactProperties.loadState(state); } }
@Nullable private static <S> ArtifactPropertiesState serializeProperties( ArtifactPropertiesProvider provider, ArtifactProperties<S> properties) { final ArtifactPropertiesState state = new ArtifactPropertiesState(); state.setId(provider.getId()); final Element options = new Element("options"); XmlSerializer.serializeInto( properties.getState(), options, new SkipDefaultValuesSerializationFilters()); if (options.getContent().isEmpty() && options.getAttributes().isEmpty()) return null; state.setOptions(options); return state; }