Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Parker2012-10-23 16:18:32 -0400
committerMiles Parker2012-10-25 14:44:41 -0400
commite76c4d6905cb57324c5fbb9c66b887d20a3fd20a (patch)
tree4d5632f7cf89dfb3200da96eb496747c013cedd3 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data
parent53af45836d0ed7fdbe9e747d0de046a93fe58326 (diff)
downloadorg.eclipse.mylyn.tasks-e76c4d6905cb57324c5fbb9c66b887d20a3fd20a.tar.gz
org.eclipse.mylyn.tasks-e76c4d6905cb57324c5fbb9c66b887d20a3fd20a.tar.xz
org.eclipse.mylyn.tasks-e76c4d6905cb57324c5fbb9c66b887d20a3fd20a.zip
392688: TaskAttribute support for Unset
Change-Id: Ia4b44d557afcda8ae30c8b165a28e4af10b4d47d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=392688
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
index a923d6573..eaa93b289 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.Assert;
*
* @author Rob Elves
* @author Steffen Pingel
+ * @author Miles Parker
* @since 3.0
*/
public final class TaskAttribute {
@@ -500,7 +501,9 @@ public final class TaskAttribute {
}
/**
- * @return empty String if not available
+ * Returns the current value for a single value attribute. For a multi-value attribute, returns the first value.
+ * Note: returns an empty string if the value has not been set <em>or</em> if the value is actually an empty string.
+ * To determine whether a value has been explicitly set, use {@link #hasValue()}.
*/
public String getValue() {
if (values.size() > 0) {
@@ -514,6 +517,18 @@ public final class TaskAttribute {
return Collections.unmodifiableList(values);
}
+ /**
+ * Indicates whether any value(s) are currently set for this attribute. Note that this is a different case from
+ * testing whether or not {@link #getValue()} returns an empty string, as it is possible that an empty string value
+ * has been explicitly set for the attribute. Call {@link #clearValues()} to return the attribute to the unset
+ * state.
+ *
+ * @return true if any value is set (may be an empty string), false if no value is set.
+ */
+ public boolean hasValue() {
+ return values.size() > 0;
+ }
+
@Override
public int hashCode() {
final int prime = 31;

Back to the top