diff --git a/src/main/java/walkingkooka/spreadsheet/meta/SpreadsheetMetadata.java b/src/main/java/walkingkooka/spreadsheet/meta/SpreadsheetMetadata.java index 550b11c1d..7752eb865 100644 --- a/src/main/java/walkingkooka/spreadsheet/meta/SpreadsheetMetadata.java +++ b/src/main/java/walkingkooka/spreadsheet/meta/SpreadsheetMetadata.java @@ -220,9 +220,9 @@ public Optional name() { * require creating a new {@link SpreadsheetMetadata}. */ public final Optional get(final SpreadsheetMetadataPropertyName propertyName) { - checkPropertyName(propertyName); - - return this.getOrGetDefaults(propertyName); + return this.getOrGetDefaults( + checkPropertyName(propertyName) + ); } /** @@ -324,9 +324,8 @@ private TextStyle getStyleOrEmpty() { */ public final SpreadsheetMetadata set(final SpreadsheetMetadataPropertyName propertyName, final V value) { - checkPropertyName(propertyName); return this.set0( - propertyName, + checkPropertyName(propertyName), propertyName.checkValue(value) // necessary because absolute references values are made relative ); } @@ -418,15 +417,15 @@ private static void reportDuplicateProperty(final SpreadsheetMetadataPropertyNam * Removes a possibly existing property returning a {@link SpreadsheetMetadata} without. */ public final SpreadsheetMetadata remove(final SpreadsheetMetadataPropertyName propertyName) { - checkPropertyName(propertyName); - - return this.remove0(propertyName); + return this.remove0( + checkPropertyName(propertyName) + ); } abstract SpreadsheetMetadata remove0(final SpreadsheetMetadataPropertyName propertyName); - private static void checkPropertyName(final SpreadsheetMetadataPropertyName propertyName) { - Objects.requireNonNull(propertyName, "propertyName"); + private static SpreadsheetMetadataPropertyName checkPropertyName(final SpreadsheetMetadataPropertyName propertyName) { + return Objects.requireNonNull(propertyName, "propertyName"); } // setOrRemove......................................................................................................