Record Class WildcardTypeDetailsImpl

java.lang.Object
java.lang.Record
org.hibernate.models.internal.WildcardTypeDetailsImpl
All Implemented Interfaces:
TypeDetails, TypeVariableScope, WildcardTypeDetails

public record WildcardTypeDetailsImpl(TypeDetails bound, boolean isExtends) extends Record implements WildcardTypeDetails
  • Constructor Details

    • WildcardTypeDetailsImpl

      public WildcardTypeDetailsImpl(TypeDetails bound, boolean isExtends)
      Creates an instance of a WildcardTypeDetailsImpl record class.
      Parameters:
      bound - the value for the bound record component
      isExtends - the value for the isExtends record component
  • Method Details

    • getBound

      public TypeDetails getBound()
      Details about the type bound to the wildcard
      Specified by:
      getBound in interface WildcardTypeDetails
    • isExtends

      public boolean isExtends()
      Indicates the type of bound -
      1. true -> ? extends Something
      2. false -> ? super Something
      Specified by:
      isExtends in interface WildcardTypeDetails
    • getExtendsBound

      public TypeDetails getExtendsBound()
      Returns the upper bound of this wildcard (e.g. SomeType for ? extends SomeType).

      Returns java.lang.Object if this wildcard declares a lower bound (? super SomeType).

      Specified by:
      getExtendsBound in interface WildcardTypeDetails
      Returns:
      the upper bound, or Object if this wildcard has a lower bound
    • getSuperBound

      public TypeDetails getSuperBound()
      Returns the lower bound of this wildcard (e.g. SomeType for ? super SomeType).

      Returns null if this wildcard declares an upper bound (? extends SomeType).

      Specified by:
      getSuperBound in interface WildcardTypeDetails
      Returns:
      the lower bound, or null if this wildcard has an upper bound
    • getName

      public String getName()
      Specified by:
      getName in interface TypeDetails
    • isImplementor

      public boolean isImplementor(Class<?> checkType)
      Description copied from interface: TypeDetails
      Whether the described class is an implementor of the given checkType.
      Specified by:
      isImplementor in interface TypeDetails
    • resolveTypeVariable

      public TypeDetails resolveTypeVariable(TypeVariableDetails typeVariable)
      Description copied from interface: TypeVariableScope
      Resolve the type of the provided type variable relative to this scope.

      For example, given

       class Thing<I extends Number> {
           I id;
       }
       
      A call to this method on the Thing scope with the type variable representing I will return the I extends Number type variable definition itself.

      If this scope defines a corresponding type argument, the concrete type is returned. For example, given

       class Stuff extends Thing<Integer> {
       }
       
      This method will yield the Integer type details.
      Specified by:
      resolveTypeVariable in interface TypeVariableScope
      Parameters:
      typeVariable - The type variable to resolve
      Returns:
      The type variable's resolved type, or null if none could be found
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • bound

      public TypeDetails bound()
      Returns the value of the bound record component.
      Returns:
      the value of the bound record component