<inspectors>
<array>
<java5Inspector xmlns="java:org.metawidget.inspector.java5" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</java5Inspector>
<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</metawidgetAnnotationInspector>
</array>
</inspectors>
<array>
<java5Inspector xmlns="java:org.metawidget.inspector.java5" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</java5Inspector>
<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</metawidgetAnnotationInspector>
</array>
</inspectors>
...ConfigReader would be smart enough to reuse the same javaBeanPropertyStyle instance. But you still had to specify all javaBeanPropertyStyle's configuration options twice. In v1.15 you can instead use id and refId to refer from one setting to another:
<inspectors>
<array>
<java5Inspector xmlns="java:org.metawidget.inspector.java5" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig" id="myPropertyStyle">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</java5Inspector>
<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle refId="myPropertyStyle" />
</propertyStyle>
</metawidgetAnnotationInspector>
</array>
</inspectors>
<array>
<java5Inspector xmlns="java:org.metawidget.inspector.java5" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle xmlns="java:org.metawidget.inspector.impl.propertystyle.javabean" config="JavaBeanPropertyStyleConfig" id="myPropertyStyle">
<supportPublicFields>
<boolean>false</boolean>
</supportPublicFields>
<privateFieldConvention>
<format>'m'{1}</format>
</privateFieldConvention>
</javaBeanPropertyStyle>
</propertyStyle>
</java5Inspector>
<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
<propertyStyle>
<javaBeanPropertyStyle refId="myPropertyStyle" />
</propertyStyle>
</metawidgetAnnotationInspector>
</array>
</inspectors>
It's a small thing, but can shorten your metawidget.xml in a big way.
Feedback welcome!
0 comments:
Post a Comment