InitialValue vs DefaultValue and persistence [message #1635852] |
Wed, 25 February 2015 19:49  |
Eclipse User |
|
|
|
Hi,
I have a field which is backed by an enumeration. It must have a value in the XML that gets written. I would like to ensure that a default value is specified in the UI and that even if no one changes that value it gets written out.
I tried using @InitialValue but it seems to have no impact on what is selected in the UI and also does not appear in the xml anyway.
This DuplicateConfig is referenced from the root element object:
@Label( standard = "Duplicate Config" )
@Type( base = DuplicateConfig.class )
@XmlBinding( path = "DuplicateConfig" )
ImpliedElementProperty PROP_DUPLICATE_CONFIG = new ImpliedElementProperty( TYPE, "DuplicateConfig" );
DuplicateConfig getDuplicateConfig();
Should I just use a @DefaultValue and a custom XML binder? Or is there something fundamental I am not understanding.
public interface DuplicateConfig extends Element {
ElementType TYPE = new ElementType(DuplicateConfig.class);
@Type( base = DuplicateMatching.class )
@XmlBinding(path = "duplicateMatching")
@Label(standard = "Duplicate Matching")
@InitialValue( text = "IgnoreNumericSuffix" )
ValueProperty PROP_DUPLICATE_MATCHING = new ValueProperty(TYPE, "DuplicateMatching");
Value<DuplicateMatching> getDuplicateMatching();
void setDuplicateMatching(String value);
void setDuplicateMatching(DuplicateMatching value);
@Label( standard = "Ignore Fqns" )
@XmlListBinding( path = "" )
@Type( base = IgnoreFqn.class )
ListProperty PROP_IGNORE_FQNS = new ListProperty( TYPE, "IgnoreFqns" );
ElementList<IgnoreFqn> getIgnoreFqns();
}
Edit - I also tried to add a @CustomXmlValueBinding but the write method is never called. I am not sure how to override the @CustomXmlElementBinding at the parent level to ensure a value gets written.
[Updated on: Wed, 25 February 2015 22:25] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.15798 seconds