Author: bobtarling
Date: 2008-11-03 14:28:20-0800
New Revision: 15962
Modified:
trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java
Log:
Begin to enforce immutability of ToDoItem
Modified: trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java?view=diff&rev=15962&p1=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java&p2=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java&r1=15961&r2=15962
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java (original)
+++ trunk/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java 2008-11-03 14:28:20-0800
@@ -115,7 +115,7 @@
*/
private ListSet theOffenders;
- private Wizard theWizard;
+ private final Wizard theWizard;
/**
* The constructor.
@@ -137,6 +137,7 @@
thePriority = p;
theDescription = d;
theMoreInfoURL = m;
+ theWizard = null;
}
/**
@@ -155,6 +156,7 @@
thePriority = p;
theDescription = d;
theMoreInfoURL = m;
+ theWizard = null;
}
/**
@@ -177,13 +179,6 @@
}
/**
- * Override in subclass to validate the offender is an expected type.
- * @param dm the offender (why dm?)
- */
- protected void checkArgument(Object dm) {
- }
-
- /**
* The constructor.
*
* @param c the poster (critic)
@@ -217,6 +212,13 @@
theWizard = c.makeWizard(this);
}
+ /**
+ * Override in subclass to validate the offender is an expected type.
+ * @param dm the offender (why dm?)
+ */
+ protected void checkArgument(Object dm) {
+ }
+
/**
* Check the offenders.<p>
@@ -261,8 +263,12 @@
}
/**
+ * @deprecated A ToDoItem should be immutable to guarantee it can be
+ * passed safely between threads. Only use the constructor to set this
+ * value.
* @param h the headline
*/
+ @Deprecated
public void setHeadline(String h) {
theHeadline = h;
cachedExpandedHeadline = null;
@@ -280,6 +286,9 @@
}
/**
+ * @deprecated A ToDoItem should be immutable to guarantee it can be
+ * passed safely between threads. Only use the constructor to set this
+ * value.
* @param d the description
*/
public void setDescription(String d) {
@@ -293,9 +302,14 @@
public String getMoreInfoURL() { return theMoreInfoURL; }
/**
+ * @deprecated A ToDoItem should be immutable to guarantee it can be
+ * passed safely between threads. Only use the constructor to set this
+ * value.
* @param m the more-info-url
*/
- public void setMoreInfoURL(String m) { theMoreInfoURL = m; }
+ public void setMoreInfoURL(String m) {
+ theMoreInfoURL = m;
+ }
/**
* @return the priority
@@ -303,9 +317,14 @@
public int getPriority() { return thePriority; }
/**
+ * @deprecated A ToDoItem should be immutable to guarantee it can be
+ * passed safely between threads. Only use the constructor to set this
+ * value.
* @param p the priority
*/
- public void setPriority(int p) { thePriority = p; }
+ public void setPriority(int p) {
+ thePriority = p;
+ }
/**
* @return the wizard progress. An integer between 0 and 100,
@@ -337,6 +356,8 @@
*
* @param offenders the offenders
* TODO: Offenders need to be more strongly typed. - tfm 20070630
+ * TODO: Provide a constructor argument for this so that the class can
+ * become immutable
*/
public void setOffenders(ListSet offenders) {
theOffenders = offenders;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.