[wildfly-dev] Persisting attributes explicitly set to default values

Brian Stansberry brian.stansberry at redhat.com
Wed Aug 26 09:35:40 EDT 2015


The standard behavior is to persist user provided values, regardless of 
whether they match the default. If the user didn't specify a value and 
thus relied upon the default, then we don't persist the default.

The downside is the xml config contains more data than strictly necessary.

The upside is the value often originally comes from the user provided 
config document, and if we don't write it back when persisting the doc 
following some unrelated change, we've changed that document 
unnecessarily. We "share" that document with the end user, so I want to 
avoid altering it in ways that are not required.

This is also why our xml marshaling should always marshal things back in 
the order they are declared in the xsd, and the standard config docs we 
ship should also follow that order. We have no way to preserve the 
original order in which unrelated things were parsed, so if the user 
doesn't follow xsd order we'll write back in a different order. But at 
least the order we write in will be predictable.

On 8/26/15 8:17 AM, Dominik Pospisil wrote:
> Is there any rule saying if an attribute should be persisted if it is
> explicitly set to it's default value or not?
>
> At least some attributes in the legacy web subsystem are persisted in such
> case and some are not.
>
> It seems that the API encourages to choose any of the options. Is there any
> reason for that?
>
> Many thanks,
>
> - Dominik
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>


-- 
Brian Stansberry
Senior Principal Software Engineer
JBoss by Red Hat


More information about the wildfly-dev mailing list