@Test public void callsDecryptOnlyOnce() { Secret s = new Secret(42, "toto", null, () -> String.valueOf(++called), "checksum", ApiDate.now(), "", ApiDate.now(), "", null, null, null, 0, 1L, ApiDate.now(), ""); assertThat(s.getSecret()).isEqualTo("1"); assertThat(s.getSecret()).isEqualTo("1"); }
public String getSecret() { if (secret == null) { secret = checkNotNull(encryptedSecret.decrypt()); } return secret; }
Secret { public String getSecret() { if (secret == null) { secret = checkNotNull(encryptedSecret.decrypt()); } return secret; } }
Secret { public String getSecret() { if (secret == null) { secret = checkNotNull(encryptedSecret.decrypt()); } return secret; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); }
Secret { public String getSecret() { if (secret == null) { secret = checkNotNull(encryptedSecret.decrypt()); } return secret; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); long getId(); String getName(); String getDisplayName(); String getDescription(); String getSecret(); String getChecksum(); ApiDate getCreatedAt(); String getCreatedBy(); ApiDate getUpdatedAt(); String getUpdatedBy(); ImmutableMap<String, String> getMetadata(); Optional<String> getType(); ImmutableMap<String, String> getGenerationOptions(); long getExpiry(); Optional<Long> getVersion(); Optional<ApiDate> getContentCreatedAt(); String getContentCreatedBy(); static int decodedLength(String secret); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
Secret { public String getSecret() { if (secret == null) { secret = checkNotNull(encryptedSecret.decrypt()); } return secret; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); long getId(); String getName(); String getDisplayName(); String getDescription(); String getSecret(); String getChecksum(); ApiDate getCreatedAt(); String getCreatedBy(); ApiDate getUpdatedAt(); String getUpdatedBy(); ImmutableMap<String, String> getMetadata(); Optional<String> getType(); ImmutableMap<String, String> getGenerationOptions(); long getExpiry(); Optional<Long> getVersion(); Optional<ApiDate> getContentCreatedAt(); String getContentCreatedBy(); static int decodedLength(String secret); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }