From b425414b745514f7d8c4284a172b21cae8077e5e Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Wed, 19 Jan 2022 19:30:13 +0100 Subject: [PATCH] [New] Added Action.isResourceDefined() and additional JavaDoc --- .../li/strolch/model/activity/Action.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java index 5798b6e62..4880281e7 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java +++ b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java @@ -146,12 +146,33 @@ public class Action extends GroupedParameterizedElement implements IActivityElem this.resourceId = resource.getId(); } + /** + * @deprecated use {@link #isResourceDefined()} + */ + @Deprecated public boolean hasResourceDefined() { return isNotEmpty(this.resourceType) && isNotEmpty(this.resourceId); } + /** + * Returns true if the {@link #getResourceType()} and {@link #getResourceId()} have defined values + * + * @return true if the {@link #getResourceType()} and {@link #getResourceId()} have defined values + */ + public boolean isResourceDefined() { + return isNotEmpty(this.resourceType) && isNotEmpty(this.resourceId); + } + + /** + * Returns the {@link Locator} for the {@link Resource} for this action + * + * @return the {@link Locator} for the {@link Resource} for this action + * + * @throws IllegalStateException + * if the resource is not defined + */ public Locator getResourceLocator() { - if (!hasResourceDefined()) + if (!isResourceDefined()) throw new IllegalStateException("Resource not set on " + getLocator()); return Resource.locatorFor(this.resourceType, this.resourceId); } @@ -186,6 +207,9 @@ public class Action extends GroupedParameterizedElement implements IActivityElem return this.changes; } + /** + * @return the iterator of {@code IValueChange} attached to the {@code Action} start + */ public Iterator>> changesIterator() { if (this.changes == null) return Collections.emptyIterator();