Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
ActiveIO
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h1>Proposal for enumeration support in Modello</h1> <p>Following <a href="http://jira.codehaus.org/browse/MODELLO-26">MODELLO-26</a>, here is a proposal (under construction) for Enumeration Handling in MODELLO.</p> <h2>Model Syntax</h2> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ... <field> <name>myEnumeration</name <type>String</type> <enumeration> <element> <key>FOO</key> <value>foo</value> </element> <element> <key>BAR</key> <value>bar</value> </element> </enumeration> </field> </pre></td></tr></table> <p>Alternativly, we could consider that the value is a java only indication and put that in java metadata. That would lead to a more compact declaration:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ... <enumeration> <element java.value="foo">FOO</element> <element java.value="bar">BAR</element> </enumeration> </pre></td></tr></table> <p>But that would be a correct notation only if the actual values of the enumeration could be considered an indication for the Java plugin only.</p> <h2>Java class declaration</h2> <p>The above model should lead to a Java class, like:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> public class myClass { public static final String FOO = "foo"; public static final String BAR = "bar"; private String myEnumeration; public String getEnumeration() { return this.myEnumeration; } } </pre></td></tr></table> <p>now, question is, where to check for model integrity?</p> <p>Should we provide a setter (setEnumeration) which would require the parameter to be one of the possible values? Like:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> private static final String[] POSSIBLE_VALUES = {FOO , BAR}; public String setEnumeration(String valeur) { if (Arrays.binarySearch(POSSIBLE_VALUES, valeur)>=0) { this.myEnumeration = valeur; } else { throw new IllegalArgumentException(...); } } </pre></td></tr></table> <p>Or just a plain setter, the integrity being the work of the parser. I guess first solution is more interesting....</p> <h2>Data parsing</h2> <p>Now, when it comes to parsing, how should we handle it? Just pass down the value to the setter, and see if it is ok with the value?<br /> Should we provide support (in the xml file) for both the keys and the values?</p> <p>Say, with the continuum-model:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> public final static int NEW = 1; public final static int OK = 2; </pre></td></tr></table> <p>Do we want to be able to handle</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <ProjectState>NEW</ProjectState> </pre></td></tr></table> <p>in the data?</p> <p>Or just:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <ProjectState>1</ProjectState> </pre></td></tr></table> <p>Or both?</p> <p>This question is a central one, since, most of the other plugins (xml parsers, xdoc, xsd) will depend on this question...</p> <p>So waiting for someone to provide an answer there <img class="emoticon emoticon-smile" data-emoticon-name="smile" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/smile.png" alt="(smile)" title="(smile)" /></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced