Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up various legacy "read path" contracts
- clean-up unused Type methods * Type#nullSafeGet * Type#hydrate * Type#resolve * Type#getSemiResolvedType * Type#semiResolve * related - start removing usage of Tuplizer - start removing usage of legacy Tuplizer-based Instantiator
- Loading branch information
Showing
24 changed files
with
323 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
hibernate-core/src/main/java/org/hibernate/internal/util/LazyValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html | ||
*/ | ||
package org.hibernate.internal.util; | ||
|
||
import java.util.function.Supplier; | ||
|
||
/** | ||
* A lazily accessible object reference. Useful for cases where final references | ||
* are needed (anon inner class, lambdas, etc). | ||
* | ||
* @param <T> The type of object referenced | ||
*/ | ||
public class LazyValue<T> { | ||
public static final Object NULL = new Object(); | ||
|
||
private final Supplier<T> supplier; | ||
private Object value; | ||
|
||
public LazyValue(Supplier<T> supplier) { | ||
this.supplier = supplier; | ||
} | ||
|
||
public Object getValue() { | ||
if ( value == null ) { | ||
final T obtainedValue = supplier.get(); | ||
if ( obtainedValue == null ) { | ||
value = NULL; | ||
} | ||
else { | ||
value = obtainedValue; | ||
} | ||
} | ||
|
||
return value == NULL ? null : value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.