
org.sapia.util.xml.confix.CreationStatus Maven / Gradle / Ivy
The newest version!
package org.sapia.util.xml.confix;
/**
* Models a "creation status". A creation status encapsulates:
*
*
* - The object that is created by a given object factory;
*
- A flag that indicates if the created instance was assigned to its
* parent - through a set/add method.
*
*
* An instance of this class is not created through a constructor; rather, it
* is created as such:
*
*
* CreationStatus stat = CreationStatus.create(someObject);
*
*
* @author Yanick Duchesne
*
* - Copyright:
- Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
* - License:
- Read the license.txt file of the jar or visit the
* license page at the Sapia OSS web site
*
*/
public class CreationStatus {
boolean _assigned = false;
Object _created;
private CreationStatus(Object created) {
_created = created;
}
/**
* Returns the created object.
*
* @return an Object
.
*/
public Object getCreated() {
// if(_created != null && _created instanceof NullObject){
// return null;
// }
return _created;
}
/**
* Sets the object that was created.
*
* @param an Object
.
*/
public void setCreated(Object created) {
_created = created;
}
/**
* Returns true
if the encapsulated object was
* assigned to its parent.
*
* @return true
if the encapsulated object was
* assigned to its parent.
*/
public boolean wasAssigned() {
return _assigned;
}
/**
* Sets this instance's "assigned" status.
*
* @param assigned if true
, indicates that the object
* encapsulated within this instance was assigned to its parent.
*/
public CreationStatus assigned(boolean assigned) {
_assigned = assigned;
return this;
}
/**
* Returns a CreationStatus
that encapsulates the given
* instance.
*
* @param created the created object.
* @return a CreationStatus
.
*/
public static CreationStatus create(Object created) {
return new CreationStatus(created);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy