You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/12/22 17:53:14 UTC
[5/5] isis git commit: ISIS-970: adding null guards for enums.
ISIS-970: adding null guards for enums.
Also: fixing a bit of javadoc.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0bdda6e6
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0bdda6e6
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0bdda6e6
Branch: refs/heads/ISIS-970
Commit: 0bdda6e67a3e115d3c4092cf65afec0c9e3eee95
Parents: 58f5540
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Dec 22 16:52:16 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Dec 22 16:52:16 2014 +0000
----------------------------------------------------------------------
.../java/org/apache/isis/applib/annotation/Action.java | 8 ++++++++
.../isis/applib/annotation/BulkInteractionContext.java | 2 ++
.../apache/isis/applib/annotation/CollectionLayout.java | 6 ++++--
.../org/apache/isis/applib/annotation/DomainObject.java | 2 ++
.../apache/isis/applib/annotation/MemberGroupLayout.java | 10 ++++------
5 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/0bdda6e6/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
index df52a3f..c498200 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
@@ -151,6 +151,7 @@ public @interface Action {
@Deprecated
public static ActionSemantics.Of from(final Semantics semantics) {
+ if(semantics == null) return null;
if(semantics == SAFE) return ActionSemantics.Of.SAFE;
if(semantics == IDEMPOTENT) return ActionSemantics.Of.IDEMPOTENT;
if(semantics == NON_IDEMPOTENT) return ActionSemantics.Of.NON_IDEMPOTENT;
@@ -160,6 +161,7 @@ public @interface Action {
@Deprecated
public static Semantics from(final ActionSemantics.Of semantics) {
+ if(semantics == null) return null;
if(semantics == ActionSemantics.Of.SAFE) return SAFE;
if(semantics == ActionSemantics.Of.IDEMPOTENT) return IDEMPOTENT;
if(semantics == ActionSemantics.Of.NON_IDEMPOTENT) return NON_IDEMPOTENT;
@@ -186,6 +188,7 @@ public @interface Action {
@Deprecated
public static Bulk.AppliesTo from(final BulkAppliesTo bulkAppliesTo) {
+ if(bulkAppliesTo == null) return null;
if(bulkAppliesTo == BULK_AND_REGULAR) return Bulk.AppliesTo.BULK_AND_REGULAR;
if(bulkAppliesTo == BULK_ONLY) return Bulk.AppliesTo.BULK_ONLY;
// shouldn't happen
@@ -194,6 +197,7 @@ public @interface Action {
@Deprecated
public static BulkAppliesTo from(final Bulk.AppliesTo appliesTo) {
+ if(appliesTo == null) return null;
if(appliesTo == Bulk.AppliesTo.BULK_AND_REGULAR) return BULK_AND_REGULAR;
if(appliesTo == Bulk.AppliesTo.BULK_ONLY) return BULK_ONLY;
// shouldn't happen
@@ -236,6 +240,7 @@ public @interface Action {
@Deprecated
public static CommandExecuteIn from(final Command.ExecuteIn executeIn) {
+ if(executeIn == null) return null;
if(executeIn == Command.ExecuteIn.FOREGROUND) return FOREGROUND;
if(executeIn == Command.ExecuteIn.BACKGROUND) return BACKGROUND;
// shouldn't happen
@@ -244,6 +249,7 @@ public @interface Action {
@Deprecated
public static Command.ExecuteIn from(final CommandExecuteIn commandExecuteIn) {
+ if(commandExecuteIn == null) return null;
if(commandExecuteIn == FOREGROUND) return Command.ExecuteIn.FOREGROUND;
if(commandExecuteIn == BACKGROUND) return Command.ExecuteIn.BACKGROUND;
// shouldn't happen
@@ -273,6 +279,7 @@ public @interface Action {
@Deprecated
public static CommandPersistence from(final Command.Persistence persistence) {
+ if(persistence == null) return null;
if(persistence == Command.Persistence.PERSISTED) return PERSISTED;
if(persistence == Command.Persistence.IF_HINTED) return IF_HINTED;
// shouldn't happen
@@ -281,6 +288,7 @@ public @interface Action {
@Deprecated
public static Command.Persistence from(final CommandPersistence commandPersistence) {
+ if(commandPersistence == null) return null;
if(commandPersistence == PERSISTED) return Command.Persistence.PERSISTED;
if(commandPersistence == IF_HINTED) return Command.Persistence.IF_HINTED;
// shouldn't happen
http://git-wip-us.apache.org/repos/asf/isis/blob/0bdda6e6/core/applib/src/main/java/org/apache/isis/applib/annotation/BulkInteractionContext.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/BulkInteractionContext.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/BulkInteractionContext.java
index 4ccb5c1..47c866e 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/BulkInteractionContext.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/BulkInteractionContext.java
@@ -47,6 +47,7 @@ public abstract class BulkInteractionContext {
@Deprecated
public static InvokedAs from(final Bulk.InteractionContext.InvokedAs invokedAs) {
+ if (invokedAs == null) return null;
if (invokedAs == Bulk.InteractionContext.InvokedAs.REGULAR) return REGULAR;
if (invokedAs == Bulk.InteractionContext.InvokedAs.BULK) return BULK;
// shouldn't happen
@@ -55,6 +56,7 @@ public abstract class BulkInteractionContext {
@Deprecated
public static Bulk.InteractionContext.InvokedAs from(final BulkInteractionContext.InvokedAs invokedAs) {
+ if (invokedAs == null) return null;
if (invokedAs == REGULAR) return Bulk.InteractionContext.InvokedAs.REGULAR;
if (invokedAs == BULK) return Bulk.InteractionContext.InvokedAs.BULK;
// shouldn't happen
http://git-wip-us.apache.org/repos/asf/isis/blob/0bdda6e6/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
index 1997937..f25753d 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
@@ -95,14 +95,16 @@ public @interface CollectionLayout {
@Deprecated
public static Render.Type typeOf(final RenderType renderType) {
- if (renderType == EAGERLY) return Render.Type.EAGERLY;
- if (renderType == LAZILY) return Render.Type.LAZILY;
+ if(renderType == null) return null;
+ if(renderType == EAGERLY) return Render.Type.EAGERLY;
+ if(renderType == LAZILY) return Render.Type.LAZILY;
// shouldn't happen
throw new IllegalArgumentException("Unrecognized renderType: " + renderType);
}
@Deprecated
public static RenderType typeOf(final Render.Type renderType) {
+ if(renderType == null) return null;
if (renderType == Render.Type.EAGERLY) return RenderType.EAGERLY;
if (renderType == Render.Type.LAZILY) return RenderType.LAZILY;
// shouldn't happen
http://git-wip-us.apache.org/repos/asf/isis/blob/0bdda6e6/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
index c73f07f..d15ba81 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
@@ -74,6 +74,7 @@ public @interface DomainObject {
@Deprecated
public static PublishedObject.ChangeKind from(final PublishingChangeKind publishingChangeKind) {
+ if(publishingChangeKind == null) return null;
if(publishingChangeKind == CREATE) return PublishedObject.ChangeKind.CREATE;
if(publishingChangeKind == UPDATE) return PublishedObject.ChangeKind.UPDATE;
if(publishingChangeKind == DELETE) return PublishedObject.ChangeKind.DELETE;
@@ -82,6 +83,7 @@ public @interface DomainObject {
}
@Deprecated
public static PublishingChangeKind from(final PublishedObject.ChangeKind publishingChangeKind) {
+ if(publishingChangeKind == null) return null;
if(publishingChangeKind == PublishedObject.ChangeKind.CREATE) return CREATE;
if(publishingChangeKind == PublishedObject.ChangeKind.UPDATE) return UPDATE;
if(publishingChangeKind == PublishedObject.ChangeKind.DELETE) return DELETE;
http://git-wip-us.apache.org/repos/asf/isis/blob/0bdda6e6/core/applib/src/main/java/org/apache/isis/applib/annotation/MemberGroupLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/MemberGroupLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/MemberGroupLayout.java
index 293608f..e681a74 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/MemberGroupLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/MemberGroupLayout.java
@@ -175,9 +175,8 @@ public @interface MemberGroupLayout {
* As {@link #left()}, but for the middle column in a page.
*
* <p>
- * If the value of this attribute is non-empty but the {@link #columnSpans()} specifies a zero size
- * (eg {@link ColumnSpans#_2_0_0_10}, then the framework will not boot and will instead indicate
- * a meta-model validation exception.
+ * If the value of this attribute is non-empty but the {@link #columnSpans()} specifies a zero size, then the
+ * framework will not boot and will instead indicate a meta-model validation exception.
*/
String[] middle() default {};
@@ -185,9 +184,8 @@ public @interface MemberGroupLayout {
* As {@link #right()}, but for the right column in a page.
*
* <p>
- * If the value of this attribute is non-empty but the {@link #columnSpans()} specifies a zero size
- * (eg {@link ColumnSpans#_2_0_0_10}, then the framework will not boot and will instead indicate
- * a meta-model validation exception.
+ * If the value of this attribute is non-empty but the {@link #columnSpans()} specifies a zero size, then the
+ * framework will not boot and will instead indicate a meta-model validation exception.
*/
String[] right() default {};