IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.ras.core.data
Interface IDataModel

All Known Subinterfaces:
IDefaultComponentExportDataModel, IDefaultExportDataModel, IDefaultWebserviceExportDataModel, IImportDataModel

public interface IDataModel

The model part of the model-view-controller implementation. This interface is a generic implementation that lets the user get and set properties, and register listeners for when the properties change. This interface is intended to primarily be used by clients but it can also be implemented.


Field Summary
static Object NULL
          The property that represents a null value.
 
Method Summary
 void addDataModelListener(IDataModelListener theListener)
          Adds a model listener that is notified when the model changes.
 boolean containsProperty(String theName)
          Checks if the model contains a property with the specified name
 Object getProperty(String theName)
          Retrieves a property with the specified name, or null if it doesn't exist
 Boolean getPropertyAsBoolean(String theName)
          Retrieves a property with the specified name as a Boolean, or null if it doesn't exist.
 Integer getPropertyAsInteger(String theName)
          Retrieves a property with the specified name as a Boolean, or null if it doesn't exist.
 String getPropertyAsString(String theName)
          Retrieves a property with the specified name as a String, or null if it doesn't exist
 void removeDataModelListener(IDataModelListener theListener)
          Removes a model listener.
 void removeProperty(String theName)
          Removes the property with the specified name (and its corresponding value) from this list of properties.
 void setProperty(String theName, boolean theValue)
          Set a property with the specified name to the specified boolean value
 void setProperty(String theName, int theValue)
          Set a property with the specified name to the specified int value
 void setProperty(String theName, Object theValue)
          Set a property with the specified name to the specified value
 

Field Detail

NULL

public static final Object NULL
The property that represents a null value. Use this instead.

Method Detail

addDataModelListener

public void addDataModelListener(IDataModelListener theListener)
                          throws NullPointerException
Adds a model listener that is notified when the model changes. Does nothing if the listener is already registered.

Parameters:
theListener - the listener to register
Throws:
NullPointerException - if the theListener was null.

removeDataModelListener

public void removeDataModelListener(IDataModelListener theListener)
                             throws NullPointerException
Removes a model listener. Does nothing if the listener wasn't registered.

Parameters:
theListener - the listener to un-registered
Throws:
NullPointerException - if the theListener was null.

containsProperty

public boolean containsProperty(String theName)
                         throws NullPointerException
Checks if the model contains a property with the specified name

Parameters:
theName - the name of the property contained in the model
Returns:
true if the model contains a property with the specified name, or false otherwise
Throws:
NullPointerException - if the theName is null.

getProperty

public Object getProperty(String theName)
                   throws NullPointerException
Retrieves a property with the specified name, or null if it doesn't exist

Parameters:
theName - the name of the property to retrieve from the model
Returns:
the value for the specified property, or null if there is no property with the specified name
Throws:
NullPointerException - if the theName is null.

getPropertyAsString

public String getPropertyAsString(String theName)
                           throws NullPointerException
Retrieves a property with the specified name as a String, or null if it doesn't exist

Parameters:
theName - the name of the property to retrieve from the model
Returns:
the value for the specified property, or null if there is no property with the specified name
Throws:
NullPointerException - if the theName is null.

getPropertyAsBoolean

public Boolean getPropertyAsBoolean(String theName)
                             throws NullPointerException
Retrieves a property with the specified name as a Boolean, or null if it doesn't exist. The Boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".

Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false.

Parameters:
theName - the name of the property to retrieve from the model
Returns:
the value for the specified name as a Boolean, or null if there is no property with the specified name
Throws:
NullPointerException - if the theName is null.

getPropertyAsInteger

public Integer getPropertyAsInteger(String theName)
                             throws NullPointerException
Retrieves a property with the specified name as a Boolean, or null if it doesn't exist. The value is interpreted as representing a signed decimal integer, exactly as if the argument were given to the java.lang.Boolean#parseInt(java.lang.String) method. The result is an Integer object that represents the integer value specified by the value.

In other words, this method returns an Integer object equal to the value of:

new Integer(Integer.parseInt(s))

Parameters:
theName - the name of the parameter to retrieve from the model
Returns:
the value for the specified name as a Integer, or null if there is no property with the specified name.
Throws:
NullPointerException - if the theName is null.

setProperty

public void setProperty(String theName,
                        boolean theValue)
                 throws NullPointerException
Set a property with the specified name to the specified boolean value

Parameters:
theName - the name for the property
theValue - the boolean value for the propery
Throws:
NullPointerException - if the theName or value is null.

setProperty

public void setProperty(String theName,
                        int theValue)
                 throws NullPointerException
Set a property with the specified name to the specified int value

Parameters:
theName - the name for the property
theValue - the int value for the propery
Throws:
NullPointerException - if the theName is null.

setProperty

public void setProperty(String theName,
                        Object theValue)
                 throws NullPointerException
Set a property with the specified name to the specified value

Parameters:
theName - the name for the property
theValue - the value for the propery
Throws:
NullPointerException - if the theName or theValue is null.

removeProperty

public void removeProperty(String theName)
                    throws NullPointerException
Removes the property with the specified name (and its corresponding value) from this list of properties. This method does nothing if there is no property with the specified name

Parameters:
theName - the name of the property to remove
Throws:
NullPointerException - if the theName is null.

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.