KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > xml > confix > CreationStatus


1 package org.sapia.util.xml.confix;
2
3
4 /**
5  * Models a "creation status". A creation status encapsulates:
6  *
7  * <ul>
8  * <li>The object that is created by a given object factory;
9  * <li>A flag that indicates if the created instance was assigned to its
10  * parent - through a set/add method.
11  * </ul>
12  *
13  * An instance of this class is not created through a constructor; rather, it
14  * is created as such:
15  *
16  * <pre>
17  * CreationStatus stat = CreationStatus.create(someObject);
18  * </pre>
19  *
20  * @author Yanick Duchesne
21  * <dl>
22  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
23  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
24  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
25  * </dl>
26  */

27 public class CreationStatus {
28   boolean _assigned = false;
29   Object JavaDoc _created;
30
31   private CreationStatus(Object JavaDoc created) {
32     _created = created;
33   }
34
35   /**
36    * Returns the created object.
37    *
38    * @return an <code>Object</code>.
39    */

40   public Object JavaDoc getCreated() {
41     // if(_created != null && _created instanceof NullObject){
42
// return null;
43
// }
44
return _created;
45   }
46
47   /**
48    * Sets the object that was created.
49    *
50    * @param an <code>Object</code>.
51    */

52   public void setCreated(Object JavaDoc created) {
53     _created = created;
54   }
55
56   /**
57    * Returns <code>true</code> if the encapsulated object was
58    * assigned to its parent.
59    *
60    * @return <code>true</code> if the encapsulated object was
61    * assigned to its parent.
62    */

63   public boolean wasAssigned() {
64     return _assigned;
65   }
66
67   /**
68    * Sets this instance's "assigned" status.
69    *
70    * @param assigned if <code>true</code>, indicates that the object
71    * encapsulated within this instance was assigned to its parent.
72    */

73   public CreationStatus assigned(boolean assigned) {
74     _assigned = assigned;
75
76     return this;
77   }
78
79   /**
80    * Returns a <code>CreationStatus</code> that encapsulates the given
81    * instance.
82    *
83    * @param created the created object.
84    * @return a <code>CreationStatus</code>.
85    */

86   public static CreationStatus create(Object JavaDoc created) {
87     return new CreationStatus(created);
88   }
89 }
90
Popular Tags