Example #1
0
 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);
   }
 }
Example #2
0
 @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;
 }
 public static <S> void copyProperties(ArtifactProperties<?> from, ArtifactProperties<S> to) {
   //noinspection unchecked
   to.loadState((S) from.getState());
 }