Skip to content

Commit

Permalink
more reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra committed Sep 17, 2024
1 parent fd58cc8 commit 1f0cd1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ default boolean hasCatalogConfig() {
return catalogConfig().isPresent();
}

@Value.Lazy
@Value.NonAttribute
default String catalogConfigOrThrow() {
return catalogConfig()
.orElseThrow(
Expand All @@ -47,7 +47,6 @@ default String catalogConfigOrThrow() {
"Attempted to read a catalog config key from a configuration that doesn't have one."));
}

@Value.NonAttribute
default T cast(Object value) {
@SuppressWarnings("unchecked")
T cast = (T) defaultValue().getClass().cast(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,26 @@

/**
* A <a href="http://immutables.github.io/style.html#custom-immutable-annotation">Custom
* {@code @Value.Immutable}</a> using {@code lazyhash=true, forceJacksonPropertyNames = false,
* clearBuilder = true, depluralize = true, and JavaBeans-style getters}.
* {@code @Value.Immutable}</a> with the following defaults:
*
* <ul>
* <li><b>lazyhash</b> - Set to {@code true} to generate hash code lazily for performance
* benefits.
* <li><b>clearBuilder</b> - Set to {@code true} to be able to reuse builder instances.
* <li><b>depluralize</b> - Set to {@code true} to use singular names for collections and arrays
* in JavaBeans-style accessors and builder methods.
* <li><b>get</b> - Accessor prefixes set to {@code get*} and {@code is*} to emulate
* JavaBeans-style getters.
* <li><b>forceJacksonPropertyNames</b> - Set to {@code false} since we use JavaBeans-style
* getters, and for better compatibility with custom naming strategies.
* </ul>
*/
@Documented
@Target(ElementType.TYPE)
@Value.Style(
defaults = @Value.Immutable(lazyhash = true),
forceJacksonPropertyNames = false,
clearBuilder = true,
depluralize = true,
get = {"get*", "is*"})
get = {"get*", "is*"},
forceJacksonPropertyNames = false)
public @interface PolarisImmutable {}

0 comments on commit 1f0cd1a

Please sign in to comment.