001    //
002    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
003    // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
004    // Any modifications to this file will be lost upon recompilation of the source schema. 
005    // Generated on: 2010.08.18 at 10:46:56 PM CEST 
006    //
007    
008    
009    package net.sourceforge.jpaxjc.ns.persistence.orm;
010    
011    import java.util.ArrayList;
012    import java.util.Iterator;
013    import java.util.List;
014    import javax.annotation.Generated;
015    import javax.xml.bind.annotation.XmlAccessType;
016    import javax.xml.bind.annotation.XmlAccessorType;
017    import javax.xml.bind.annotation.XmlAttribute;
018    import javax.xml.bind.annotation.XmlElement;
019    import javax.xml.bind.annotation.XmlType;
020    
021    
022    /**
023     * 
024     * 
025     *         @Target({METHOD, FIELD}) @Retention(RUNTIME)
026     *         public @interface ManyToOne {
027     *           Class targetEntity() default void.class;
028     *           CascadeType[] cascade() default {};
029     *           FetchType fetch() default EAGER;
030     *           boolean optional() default true;
031     *         }
032     * 
033     *       
034     * 
035     * <p>Java class for many-to-one complex type.
036     * 
037     * <p>The following schema fragment specifies the expected content contained within this class.
038     * 
039     * <pre>
040     * &lt;complexType name="many-to-one">
041     *   &lt;complexContent>
042     *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
043     *       &lt;sequence>
044     *         &lt;choice>
045     *           &lt;element name="join-column" type="{http://java.sun.com/xml/ns/persistence/orm}join-column" maxOccurs="unbounded" minOccurs="0"/>
046     *           &lt;element name="join-table" type="{http://java.sun.com/xml/ns/persistence/orm}join-table" minOccurs="0"/>
047     *         &lt;/choice>
048     *         &lt;element name="cascade" type="{http://java.sun.com/xml/ns/persistence/orm}cascade-type" minOccurs="0"/>
049     *       &lt;/sequence>
050     *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
051     *       &lt;attribute name="target-entity" type="{http://www.w3.org/2001/XMLSchema}string" />
052     *       &lt;attribute name="fetch" type="{http://java.sun.com/xml/ns/persistence/orm}fetch-type" />
053     *       &lt;attribute name="optional" type="{http://www.w3.org/2001/XMLSchema}boolean" />
054     *     &lt;/restriction>
055     *   &lt;/complexContent>
056     * &lt;/complexType>
057     * </pre>
058     * 
059     * 
060     */
061    @XmlAccessorType(XmlAccessType.FIELD)
062    @XmlType(name = "many-to-one", propOrder = {
063        "joinColumn",
064        "joinTable",
065        "cascade"
066    })
067    @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
068    public class ManyToOne implements Cloneable
069    {
070    
071        @XmlElement(name = "join-column")
072        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
073        protected List<JoinColumn> joinColumn;
074        @XmlElement(name = "join-table")
075        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
076        protected JoinTable joinTable;
077        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
078        protected CascadeType cascade;
079        @XmlAttribute(required = true)
080        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
081        protected String name;
082        @XmlAttribute(name = "target-entity")
083        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
084        protected String targetEntity;
085        @XmlAttribute
086        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
087        protected FetchType fetch;
088        @XmlAttribute
089        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
090        protected Boolean optional;
091    
092        /**
093         * Creates a new {@code ManyToOne} instance.
094         * 
095         */
096        public ManyToOne() {
097            // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
098            super();
099        }
100    
101        /**
102         * Creates a new {@code ManyToOne} instance by deeply copying a given {@code ManyToOne} instance.
103         * 
104         * 
105         * @param o
106         *     The instance to copy.
107         * @throws NullPointerException
108         *     if {@code o} is {@code null}.
109         */
110        public ManyToOne(final ManyToOne o) {
111            // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
112            super();
113            if (o == null) {
114                throw new NullPointerException("Cannot create a copy of 'ManyToOne' from 'null'.");
115            }
116            // 'JoinColumn' collection.
117            copyJoinColumn(o.getJoinColumn(), getJoinColumn());
118            // CClassInfo: net.sourceforge.jpaxjc.ns.persistence.orm.JoinTable
119            this.joinTable = ((o.getJoinTable() == null)?null:o.getJoinTable().clone());
120            // CClassInfo: net.sourceforge.jpaxjc.ns.persistence.orm.CascadeType
121            this.cascade = ((o.getCascade() == null)?null:o.getCascade().clone());
122            // CBuiltinLeafInfo: java.lang.String
123            this.name = o.getName();
124            // CBuiltinLeafInfo: java.lang.String
125            this.targetEntity = o.getTargetEntity();
126            // CEnumLeafInfo: net.sourceforge.jpaxjc.ns.persistence.orm.FetchType
127            this.fetch = o.getFetch();
128            // CBuiltinLeafInfo: java.lang.Boolean
129            this.optional = o.isOptional();
130        }
131    
132        /**
133         * Gets the value of the joinColumn property.
134         * 
135         * <p>
136         * This accessor method returns a reference to the live list,
137         * not a snapshot. Therefore any modification you make to the
138         * returned list will be present inside the JAXB object.
139         * This is why there is not a <CODE>set</CODE> method for the joinColumn property.
140         * 
141         * <p>
142         * For example, to add a new item, do as follows:
143         * <pre>
144         *    getJoinColumn().add(newItem);
145         * </pre>
146         * 
147         * 
148         * <p>
149         * Objects of the following type(s) are allowed in the list
150         * {@link JoinColumn }
151         * 
152         * 
153         */
154        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
155        public List<JoinColumn> getJoinColumn() {
156            if (joinColumn == null) {
157                joinColumn = new ArrayList<JoinColumn>();
158            }
159            return this.joinColumn;
160        }
161    
162        /**
163         * Gets the value of the joinTable property.
164         * 
165         * @return
166         *     possible object is
167         *     {@link JoinTable }
168         *     
169         */
170        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
171        public JoinTable getJoinTable() {
172            return joinTable;
173        }
174    
175        /**
176         * Sets the value of the joinTable property.
177         * 
178         * @param value
179         *     allowed object is
180         *     {@link JoinTable }
181         *     
182         */
183        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
184        public void setJoinTable(JoinTable value) {
185            this.joinTable = value;
186        }
187    
188        /**
189         * Gets the value of the cascade property.
190         * 
191         * @return
192         *     possible object is
193         *     {@link CascadeType }
194         *     
195         */
196        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
197        public CascadeType getCascade() {
198            return cascade;
199        }
200    
201        /**
202         * Sets the value of the cascade property.
203         * 
204         * @param value
205         *     allowed object is
206         *     {@link CascadeType }
207         *     
208         */
209        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
210        public void setCascade(CascadeType value) {
211            this.cascade = value;
212        }
213    
214        /**
215         * Gets the value of the name property.
216         * 
217         * @return
218         *     possible object is
219         *     {@link String }
220         *     
221         */
222        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
223        public String getName() {
224            return name;
225        }
226    
227        /**
228         * Sets the value of the name property.
229         * 
230         * @param value
231         *     allowed object is
232         *     {@link String }
233         *     
234         */
235        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
236        public void setName(String value) {
237            this.name = value;
238        }
239    
240        /**
241         * Gets the value of the targetEntity property.
242         * 
243         * @return
244         *     possible object is
245         *     {@link String }
246         *     
247         */
248        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
249        public String getTargetEntity() {
250            return targetEntity;
251        }
252    
253        /**
254         * Sets the value of the targetEntity property.
255         * 
256         * @param value
257         *     allowed object is
258         *     {@link String }
259         *     
260         */
261        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
262        public void setTargetEntity(String value) {
263            this.targetEntity = value;
264        }
265    
266        /**
267         * Gets the value of the fetch property.
268         * 
269         * @return
270         *     possible object is
271         *     {@link FetchType }
272         *     
273         */
274        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
275        public FetchType getFetch() {
276            return fetch;
277        }
278    
279        /**
280         * Sets the value of the fetch property.
281         * 
282         * @param value
283         *     allowed object is
284         *     {@link FetchType }
285         *     
286         */
287        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
288        public void setFetch(FetchType value) {
289            this.fetch = value;
290        }
291    
292        /**
293         * Gets the value of the optional property.
294         * 
295         * @return
296         *     possible object is
297         *     {@link Boolean }
298         *     
299         */
300        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
301        public Boolean isOptional() {
302            return optional;
303        }
304    
305        /**
306         * Sets the value of the optional property.
307         * 
308         * @param value
309         *     allowed object is
310         *     {@link Boolean }
311         *     
312         */
313        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
314        public void setOptional(Boolean value) {
315            this.optional = value;
316        }
317    
318        /**
319         * Copies all values of property {@code JoinColumn} deeply.
320         * 
321         * @param target
322         *     The target to copy {@code source} to.
323         * @param source
324         *     The source to copy from.
325         * @throws NullPointerException
326         *     if {@code source} or {@code target} is {@code null}.
327         */
328        @SuppressWarnings("unchecked")
329        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
330        private static void copyJoinColumn(final List<JoinColumn> source, final List<JoinColumn> target) {
331            // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
332            if (!source.isEmpty()) {
333                for (Iterator it = source.iterator(); it.hasNext(); ) {
334                    final Object next = it.next();
335                    if (next instanceof JoinColumn) {
336                        // CClassInfo: net.sourceforge.jpaxjc.ns.persistence.orm.JoinColumn
337                        target.add(((JoinColumn) next).clone());
338                        continue;
339                    }
340                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
341                    throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'JoinColumn' of class 'net.sourceforge.jpaxjc.ns.persistence.orm.ManyToOne'."));
342                }
343            }
344        }
345    
346        /**
347         * Creates and returns a deep copy of this object.
348         * 
349         * 
350         * @return
351         *     A deep copy of this object.
352         */
353        @Override
354        @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-08-18T10:46:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
355        public ManyToOne clone() {
356            // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000
357            return new ManyToOne(this);
358        }
359    
360    }