Skip to content

Commit

Permalink
renamed getStaticSafeValue() to getFallbackSafeValue() to avoid confu…
Browse files Browse the repository at this point in the history
…sion since not every implementation and result is created in a "static" way
  • Loading branch information
hohwille committed May 5, 2024
1 parent d606863 commit 68ed0dd
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 32 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/io/github/mmm/value/ReadableValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ public abstract interface ReadableValue<V> extends Supplier<V> {
V get();

/**
* @return the value of {@link #get()} but in case this is {@code null} it will return {@link #getStaticSafeValue()}.
* So unless {@link #getStaticSafeValue()} also returns {@code null} this method a null-safe variant of
* @return the value of {@link #get()} but in case this is {@code null} it will return {@link #getFallbackSafeValue()}.
* So unless {@link #getFallbackSafeValue()} also returns {@code null} this method a null-safe variant of
* {@link #get()}.
* @see #getStaticSafeValue()
* @see #getFallbackSafeValue()
*/
default V getSafe() {

V value = get();
if (value == null) {
value = getStaticSafeValue();
value = getFallbackSafeValue();
}
return value;
}
Expand All @@ -38,7 +38,7 @@ default V getSafe() {
* {@link String}, {@code 0} for any kind of {@link Number}, {@link Boolean#FALSE}, empty collection, etc.).
* May still be {@code null} for types that have no such neutral element.
*/
V getStaticSafeValue();
V getFallbackSafeValue();

/**
* Null-safe access to {@link #get()}.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/github/mmm/value/SimplePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Object get() {
}

@Override
public Object getStaticSafeValue() {
public Object getFallbackSafeValue() {

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default boolean getValue() {
}

@Override
default Boolean getStaticSafeValue() {
default Boolean getFallbackSafeValue() {

return Boolean.FALSE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default Class<List<E>> getValueClass() {
}

@Override
default List<E> getStaticSafeValue() {
default List<E> getFallbackSafeValue() {

return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ default int size() {
}

@Override
default Map<K, V> getStaticSafeValue() {
default Map<K, V> getFallbackSafeValue() {

return Collections.emptyMap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default Class<Set<E>> getValueClass() {
}

@Override
default Set<E> getStaticSafeValue() {
default Set<E> getFallbackSafeValue() {

return Collections.emptySet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ default E getValue() {
}

@Override
default E getStaticSafeValue() {
default E getFallbackSafeValue() {

Class<E> valueClass = getValueClass();
if (valueClass == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ default Class<Locale> getValueClass() {
}

@Override
default Locale getStaticSafeValue() {
default Locale getFallbackSafeValue() {

return Locale.ROOT;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<BigDecimal> getValueClass() {
}

@Override
default BigDecimal getStaticSafeValue() {
default BigDecimal getFallbackSafeValue() {

return BigDecimal.ZERO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<BigInteger> getValueClass() {
}

@Override
default BigInteger getStaticSafeValue() {
default BigInteger getFallbackSafeValue() {

return BigInteger.ZERO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default byte getValue() {
}

@Override
default Byte getStaticSafeValue() {
default Byte getFallbackSafeValue() {

return Byte.valueOf((byte) 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default double getValue() {
}

@Override
default Double getStaticSafeValue() {
default Double getFallbackSafeValue() {

return Double.valueOf(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default float getValue() {
}

@Override
default Float getStaticSafeValue() {
default Float getFallbackSafeValue() {

return Float.valueOf(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default int getValue() {
}

@Override
default Integer getStaticSafeValue() {
default Integer getFallbackSafeValue() {

return Integer.valueOf(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default long getValue() {
}

@Override
default Long getStaticSafeValue() {
default Long getFallbackSafeValue() {

return Long.valueOf(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ default short getValue() {
}

@Override
default Short getStaticSafeValue() {
default Short getFallbackSafeValue() {

return Short.valueOf((short) 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public interface ReadablePatternValue extends ReadableSimpleValue<Pattern> {

/** @see #getStaticSafeValue() */
/** @see #getFallbackSafeValue() */
Pattern STATIC_SAFE_VALUE = Pattern.compile("");

@Override
Expand Down Expand Up @@ -44,7 +44,7 @@ default Pattern getValue() {
}

@Override
default Pattern getStaticSafeValue() {
default Pattern getFallbackSafeValue() {

return STATIC_SAFE_VALUE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ default String getValue() {
}

@Override
default String getStaticSafeValue() {
default String getFallbackSafeValue() {

return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ default Class<Duration> getValueClass() {
}

@Override
default Duration getStaticSafeValue() {
default Duration getFallbackSafeValue() {

return Duration.ZERO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<Instant> getValueClass() {
}

@Override
default Instant getStaticSafeValue() {
default Instant getFallbackSafeValue() {

return Instant.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<LocalDate> getValueClass() {
}

@Override
default LocalDate getStaticSafeValue() {
default LocalDate getFallbackSafeValue() {

return LocalDate.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<LocalDateTime> getValueClass() {
}

@Override
default LocalDateTime getStaticSafeValue() {
default LocalDateTime getFallbackSafeValue() {

return LocalDateTime.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<LocalTime> getValueClass() {
}

@Override
default LocalTime getStaticSafeValue() {
default LocalTime getFallbackSafeValue() {

return LocalTime.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<OffsetDateTime> getValueClass() {
}

@Override
default OffsetDateTime getStaticSafeValue() {
default OffsetDateTime getFallbackSafeValue() {

return OffsetDateTime.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default Class<OffsetTime> getValueClass() {
}

@Override
default OffsetTime getStaticSafeValue() {
default OffsetTime getFallbackSafeValue() {

return OffsetTime.MIN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
public interface ReadableZonedDateTimeValue extends ReadableTemporalValue<ZonedDateTime> {

/** @see #getStaticSafeValue() */
/** @see #getFallbackSafeValue() */
ZonedDateTime STATIC_SAFE_VALUE = ZonedDateTime.of(LocalDateTime.MIN, ZoneOffset.MIN);

@Override
Expand All @@ -25,7 +25,7 @@ default Class<ZonedDateTime> getValueClass() {
}

@Override
default ZonedDateTime getStaticSafeValue() {
default ZonedDateTime getFallbackSafeValue() {

return STATIC_SAFE_VALUE;
}
Expand Down

0 comments on commit 68ed0dd

Please sign in to comment.