• Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 126 for Xml/xsd-fu/trunk/templates/Class.template

Show
Ignore:
Timestamp:
11/21/07 15:30:43 (14 months ago)
Author:
callan
Message:

Support a few further things that Curtis needs:

  • Accesors for objects that follow OME XML reference naming conventions
  • New convenience constructors that re-institute the org.openmicroscopy.xml semantics
Files:
1 modified

  • Xml/xsd-fu/trunk/templates/Class.template (modified) (2 diffs)

Legend:

Unmodified
Added
Removed
  • Xml/xsd-fu/trunk/templates/Class.template

    r111 r126  
    3939package ${fu.package}; 
    4040 
     41import ome.xml.DOMUtil; 
     42import ome.xml.OMEXMLNode; 
     43 
    4144import java.util.Vector; 
     45import java.util.List; 
     46 
    4247import org.w3c.dom.Element; 
    4348 
    4449public class ${klass.name}Node extends ${klass.javaBase} 
    4550{ 
    46         // -- Constructor -- 
     51        // -- Constructors -- 
    4752         
     53        /** Constructs a ${klass.name} node with an associated DOM element. */ 
    4854        public ${klass.name}Node(Element element) 
    4955        { 
    5056                super(element); 
    5157        } 
    52          
     58 
     59        /** 
     60         * Constructs a ${klass.name} node with an associated DOM element beneath 
     61         * a given parent. 
     62         */ 
     63        public ${klass.name}Node(OMEXMLNode parent) 
     64        { 
     65                this(parent, true); 
     66        } 
     67 
     68        /** 
     69         * Constructs a ${klass.name} node with an associated DOM element beneath 
     70         * a given parent. 
     71         */ 
     72        public ${klass.name}Node(OMEXMLNode parent, boolean attach) 
     73        { 
     74                super(DOMUtil.createChild(parent.getDOMElement(), 
     75                                          "${klass.name}", attach)); 
     76        } 
     77 
    5378        // -- ${klass.name} API methods -- 
    5479{% for prop in klass.properties.values() %}\ 
    5580  {% choose %}\ 
    56     {% when prop.isAttribute and prop.type[-2:] == "ID" and prop.name not in fu.DO_NOT_PROCESS %} 
     81    {% when prop.isReference %} 
     82        // Virtual, inferred back reference ${prop.name} 
     83        public List get${prop.javaType}List() 
     84        { 
     85                return getReferringNodes("${prop.javaType}"); 
     86        } 
     87         
     88        public int count${prop.javaType}List() 
     89        { 
     90                return getReferringCount("${prop.javaType}"); 
     91        } 
     92    {% end %}\ 
     93    {% when prop.isAttribute and prop.type[-2:] == "ID" and \ 
     94       prop.name not in fu.DO_NOT_PROCESS %} 
    5795        // Attribute which is an OME XML "ID" 
    5896        public ${prop.javaType} get${prop.name}() 
    … …  
    141179        } 
    142180} 
     181 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/