java.lang.Object
java.lang.Record
jakarta.persistence.sql.ConstructorMapping<T>
- Type Parameters:
T- The type of the Java class- Record Components:
targetClass- The Java class which declares the constructorarguments- Mappings assigned to the parameters of the constructor
- All Implemented Interfaces:
MappingElement<T>,ResultSetMapping<T>,TupleElement<T>
public record ConstructorMapping<T>(Class<T> targetClass, MappingElement<?>[] arguments)
extends Record
implements MappingElement<T>, ResultSetMapping<T>
Maps columns of a JDBC
ResultSet to parameters
of the constructor of a Java class.- Since:
- 4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorMapping(Class<T> targetClass, MappingElement<?>[] arguments) Creates an instance of aConstructorMappingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionMappingElement<?>[]Returns the value of theargumentsrecord component.final booleanIndicates whether some other object is "equal to" this one.getAlias()Always returnsnull.The Java class which declares the constructor.final inthashCode()Returns a hash code value for this object.static <T> ConstructorMapping<T> of(Class<T> targetClass, MappingElement<?>... arguments) Construct a new instance.Returns the value of thetargetClassrecord component.final StringtoString()Returns a string representation of this record class.type()The Java class which declares the constructor.
-
Constructor Details
-
ConstructorMapping
Creates an instance of aConstructorMappingrecord class.- Parameters:
targetClass- the value for thetargetClassrecord componentarguments- the value for theargumentsrecord component
-
-
Method Details
-
getJavaType
The Java class which declares the constructor.- Specified by:
getJavaTypein interfaceTupleElement<T>- Returns:
- the Java type of the tuple element
-
getAlias
Always returnsnull.- Specified by:
getAliasin interfaceTupleElement<T>- Returns:
- alias
-
of
Construct a new instance.- Type Parameters:
T- The type of the Java class- Parameters:
targetClass- The Java class which declares the constructorarguments- Mappings assigned to the parameters of the constructor
-
type
The Java class which declares the constructor.- Specified by:
typein interfaceResultSetMapping<T>
-
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. -
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. -
equals
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. All components in this record class are compared withObjects::equals(Object,Object). -
targetClass
Returns the value of thetargetClassrecord component.- Returns:
- the value of the
targetClassrecord component
-
arguments
Returns the value of theargumentsrecord component.- Returns:
- the value of the
argumentsrecord component
-