Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.model
Class Model

    java.lang.Object
      com.bea.p13n.model.Model

All Implemented Interfaces
  Serializable, Cloneable

Direct Known Subclasses:
  CampaignModel.ScenarioLink, ScenarioModel.RuleSetLink, XmlObjectModel

    public abstract class Model

extends Object
implements Cloneable, Serializable

The base model class for all wlp-schema based model. Models are specifically not thread-safe.

See Also
  Serialized Form

Nested Class Summary
`static class` | `Model.ChangeEvent` A model change event.
`static interface` | `Model.ChangeListener` The interface to listen to a model's change events.
`static class` | `Model.ChangeSupport` Helper class for managing ChangeListeners.
`static class` | `Model.Debug` Debug class.

Field Summary
`protected List<Model>` | `childrenModels` Our children models.
`protected DocumentModel` | `docModel` Our DocumentModel.
`protected Model` | `parentModel` Our parent model.
`protected List<Model>` | `roChildrenModels` A read-only list of our children models.

Constructor Summary
`Model()` Empty constructor.
`Model(DocumentModel docModel)` Constructor with a container document model.

Method Summary
`void` | `addChangeListener(Model.ChangeListener cl)` Add a change listener to this model instance.
`protected void` | `addChild(Model child)` Add a child to this model.
`protected void` | `addChild(Model child, int pos)` Add a child to this model.
`protected boolean` | `childAdded(Model child)` Handle the post-processing of a child being added.
`protected boolean` | `childRemoved(Model child)` Handle the post-processing of a child being removed.
`Object` | `clone()` Make clone of this object initialize with the same data, but unassociated to the original.
`abstract Model` | `copy()` Make a new Model of the same type as this, initialized with the same underlying data, but otherwise unassociated to this one.
`static boolean` | `doubleEquals(Number o1, Number o2)` A null-aware equals() method against doubleValue().
`static boolean` | `equals(Object o1, Object o2)` A null-aware equals() method.
`List<Model>` | `getChildren()` Get a read-only list of our children models.
`static Model.Debug` | `getDebug(Class cl)` Get the Debug object for the specified class.
`static Model.Debug` | `getDebug(String name)` Get the Debug object for the specified name.
`DocumentModel` | `getDocument()` Get our DocumentModel (null if none set).
`Model` | `getParent()` Get our parent model, null if this is a root or was removed from its parent.
`static boolean` | `longEquals(Number o1, Number o2)` A null-aware equals() method against longValue().
`void` | `preRemove()` Called just prior to this model being removed from its parent.
`protected boolean` | `propertyChanged(String propName, Object oldVal, Object newVal)` Handle the post-processing of a property change.
`boolean` | `removeChangeListener(Model.ChangeListener cl)` Remove a change listener from this model instance.
`protected Model` | `removeChild(int index)` Remove a child from this model by index.
`protected boolean` | `removeChild(Model child)` Remove a child from this model.
`static String[]` | `removeEmpties(String[] strs)` Remove null or empty strings from the array.
`void` | `setDocument(DocumentModel docModel)` Set our DocumentModel (null for none).
`protected void` | `setParent(Model parent)` Set our parent model (null if this is a root or was removed from its parent).

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### docModel

    protected DocumentModel docModel

  Our DocumentModel.

### childrenModels

    protected List<Model> childrenModels

  Our children models. This will be null until a child is added.

### roChildrenModels

    protected transient List<Model> roChildrenModels

  A read-only list of our children models. This will be null until the children are asked for.

### parentModel

    protected Model parentModel

  Our parent model.

Constructor Detail

### Model

    public Model(DocumentModel docModel)

  Constructor with a container document model.

### Model

    public Model()

  Empty constructor.

Method Detail

### clone

    public Object clone()

  Make clone of this object initialize with the same data, but unassociated to the original.

  Overrides:
    `clone` in class `Object`

### copy

    public abstract Model copy()

  Make a new Model of the same type as this, initialized with the same underlying data, but otherwise unassociated to this one. Listeners will not be propogated to copies.

### getDocument

    public DocumentModel getDocument()

  Get our DocumentModel (null if none set).

### setDocument

    public void setDocument(DocumentModel docModel)

  Set our DocumentModel (null for none). This will set the DocumentModel on our children as well (which will set it for entire tree underneath us).

### getParent

    public Model getParent()

  Get our parent model, null if this is a root or was removed from its parent.

### setParent

    protected void setParent(Model parent)

  Set our parent model (null if this is a root or was removed from its parent).

### preRemove

    public void preRemove()

  Called just prior to this model being removed from its parent.

  `setParent(null)` will be called after the model has been removed. Subclasses can override this to help deal with being removed from their parent.

  Models that have children should call this method prior to unhooking any underlying datastore; this will allow the child model to know they are being removed and to prepare themselves appropriately.

### getChildren

    public List<Model> getChildren()

  Get a read-only list of our children models. This will always return a non null List.

### addChild

    protected void addChild(Model child,
                            int pos)

  Add a child to this model. This will not fire any change events; it's designed to be used by subclasses.

  Parameters
    `child` - the child model to add.
    `pos` - the position to add child at, -1 for the end.

### addChild

    protected void addChild(Model child)

  Add a child to this model. This will not fire an change events; it's designed to be used by subclasses. This will add the child to the end of the list of children.

  Parameters
    `child` - the child model to add.

### removeChild

    protected boolean removeChild(Model child)

  Remove a child from this model. This will not fire an change events; it's designed to be used by subclasses.

  Parameters
    `child` - the child model to remove.
  Returns
    true if the child was removed, false if not found.

### removeChild

    protected Model removeChild(int index)

  Remove a child from this model by index. This will not fire an change events; it's designed to be used by subclasses.

  Parameters
    `index` - the child model to remove.
  Returns
    the child which was removed.

### addChangeListener

    public void addChangeListener(Model.ChangeListener cl)

  Add a change listener to this model instance. The listener will only receive change events from this instance. The source of the events will be this model instance.

### removeChangeListener

    public boolean removeChangeListener(Model.ChangeListener cl)

  Remove a change listener from this model instance.

  Returns
    true if removed, false if not found.

### propertyChanged

    protected boolean propertyChanged(String propName,
                                      Object oldVal,
                                      Object newVal)

  Handle the post-processing of a property change. This will fire a ChangeEvent from us, and then call modelPropertyChanged() on our DocumentModel (if set).

  Parameters
    `propName` - the property name.
    `oldVal` - the previous value (null is valid).
    `newVal` - the new value (null is valid).
  Returns
    true if we handled this changed, false if it was ignored.

### childAdded

    protected boolean childAdded(Model child)

  Handle the post-processing of a child being added. This will fire a ChangeEvent from us, and then call modelChildAdded() on our DocumentModel (if set).

  Parameters
    `child` - the child that was added.
  Returns
    true if we handled this changed, false if it was ignored.

### childRemoved

    protected boolean childRemoved(Model child)

  Handle the post-processing of a child being removed. This will fire a ChangeEvent from us, and then call modelChildRemoved() on our DocumentModel (if set).

  Parameters
    `child` - the child that was removed.
  Returns
    true if we handled this changed, false if it was ignored.

### equals

    public static boolean equals(Object o1,
                                 Object o2)

  A null-aware equals() method.

### longEquals

    public static boolean longEquals(Number o1,
                                     Number o2)

  A null-aware equals() method against longValue(). Number subclass' equals() methods are often Class-aware, so this will compare the longValue()s of each

### doubleEquals

    public static boolean doubleEquals(Number o1,
                                       Number o2)

  A null-aware equals() method against doubleValue(). Number subclass' equals() methods are often Class-aware, so this will compare the doubleValue()s of each

### removeEmpties

    public static String[] removeEmpties(String[] strs)

  Remove null or empty strings from the array.

  Returns
    the same array if no change, a new array, or null if none left.

### getDebug

    public static Model.Debug getDebug(Class cl)

  Get the Debug object for the specified class.

  See Also
    `getDebug(java.lang.String)`

### getDebug

    public static Model.Debug getDebug(String name)

  Get the Debug object for the specified name. This works the same as `Debug`, except it doesn't obey the out.file and reloadable flags. So, output always go to System.err and this won't reload debug.properties if it changes.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.