[java-shib-shared] branch main updated: JSSH-27 - Implement an ensureId method to help with nullability annotation
Ian Young
ian at iay.org.uk
Fri Apr 21 16:15:52 UTC 2023
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=9af5e7fd8b06afbc8657e17cc1aed80df83375ed
The following commit(s) were added to refs/heads/main by this push:
new 9af5e7fd JSSH-27 - Implement an ensureId method to help with nullability annotation
9af5e7fd is described below
commit 9af5e7fd8b06afbc8657e17cc1aed80df83375ed
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Apr 21 17:15:44 2023 +0100
JSSH-27 - Implement an ensureId method to help with nullability annotation
https://shibboleth.atlassian.net/browse/JSSH-27
---
.../AbstractIdentifiedInitializableComponent.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/shib-support/src/main/java/net/shibboleth/shared/component/AbstractIdentifiedInitializableComponent.java b/shib-support/src/main/java/net/shibboleth/shared/component/AbstractIdentifiedInitializableComponent.java
index 42120d1d..43b5dc9e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/component/AbstractIdentifiedInitializableComponent.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/component/AbstractIdentifiedInitializableComponent.java
@@ -41,6 +41,25 @@ public abstract class AbstractIdentifiedInitializableComponent extends AbstractI
return id;
}
+ /**
+ * Return the ID of this component, guaranteeing a non-<code>null</code>
+ * result.
+ *
+ * @return the ID of this component, never <code>null</code>
+ * @throws IllegalStateException if called before the ID has been set
+ *
+ * @see #getId()
+ *
+ * @since 9.0.0
+ */
+ protected final @Nonnull String ensureId() {
+ final var id = getId();
+ if (id == null) {
+ throw new IllegalStateException();
+ }
+ return id;
+ }
+
/**
* Checks if the component is destroyed and, if so, throws a {@link DestroyedComponentException}.
*/
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list