[jOOQ/jOOQ#11778] DefaultRecordMapper should reflect on
Class.getRecordComponents()
This commit is contained in:
parent
20b8c2f5ef
commit
5972144ff4
@ -199,6 +199,8 @@ public class Settings
|
||||
@XmlElement(defaultValue = "true")
|
||||
protected Boolean mapJPAAnnotations = true;
|
||||
@XmlElement(defaultValue = "true")
|
||||
protected Boolean mapRecordComponentParameterNames = true;
|
||||
@XmlElement(defaultValue = "true")
|
||||
protected Boolean mapConstructorPropertiesParameterNames = true;
|
||||
@XmlElement(defaultValue = "false")
|
||||
protected Boolean mapConstructorParameterNames = false;
|
||||
@ -1832,6 +1834,30 @@ public class Settings
|
||||
this.mapJPAAnnotations = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether constructor parameter names obtained from the {@link java.lang.Record} component names should be considered by the DefaultRecordMapper.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isMapRecordComponentParameterNames() {
|
||||
return mapRecordComponentParameterNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the mapRecordComponentParameterNames property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setMapRecordComponentParameterNames(Boolean value) {
|
||||
this.mapRecordComponentParameterNames = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether constructor parameter names obtained from the {@link java.beans.ConstructorProperties} annotation should be considered by the DefaultRecordMapper.
|
||||
*
|
||||
@ -3229,6 +3255,11 @@ public class Settings
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withMapRecordComponentParameterNames(Boolean value) {
|
||||
setMapRecordComponentParameterNames(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withMapConstructorPropertiesParameterNames(Boolean value) {
|
||||
setMapConstructorPropertiesParameterNames(value);
|
||||
return this;
|
||||
@ -3679,6 +3710,7 @@ public class Settings
|
||||
builder.append("returnAllOnUpdatableRecord", returnAllOnUpdatableRecord);
|
||||
builder.append("returnRecordToPojo", returnRecordToPojo);
|
||||
builder.append("mapJPAAnnotations", mapJPAAnnotations);
|
||||
builder.append("mapRecordComponentParameterNames", mapRecordComponentParameterNames);
|
||||
builder.append("mapConstructorPropertiesParameterNames", mapConstructorPropertiesParameterNames);
|
||||
builder.append("mapConstructorParameterNames", mapConstructorParameterNames);
|
||||
builder.append("mapConstructorParameterNamesInKotlin", mapConstructorParameterNamesInKotlin);
|
||||
@ -4348,6 +4380,15 @@ public class Settings
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (mapRecordComponentParameterNames == null) {
|
||||
if (other.mapRecordComponentParameterNames!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!mapRecordComponentParameterNames.equals(other.mapRecordComponentParameterNames)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (mapConstructorPropertiesParameterNames == null) {
|
||||
if (other.mapConstructorPropertiesParameterNames!= null) {
|
||||
return false;
|
||||
@ -4827,6 +4868,7 @@ public class Settings
|
||||
result = ((prime*result)+((returnAllOnUpdatableRecord == null)? 0 :returnAllOnUpdatableRecord.hashCode()));
|
||||
result = ((prime*result)+((returnRecordToPojo == null)? 0 :returnRecordToPojo.hashCode()));
|
||||
result = ((prime*result)+((mapJPAAnnotations == null)? 0 :mapJPAAnnotations.hashCode()));
|
||||
result = ((prime*result)+((mapRecordComponentParameterNames == null)? 0 :mapRecordComponentParameterNames.hashCode()));
|
||||
result = ((prime*result)+((mapConstructorPropertiesParameterNames == null)? 0 :mapConstructorPropertiesParameterNames.hashCode()));
|
||||
result = ((prime*result)+((mapConstructorParameterNames == null)? 0 :mapConstructorParameterNames.hashCode()));
|
||||
result = ((prime*result)+((mapConstructorParameterNamesInKotlin == null)? 0 :mapConstructorParameterNamesInKotlin.hashCode()));
|
||||
|
||||
@ -67,6 +67,7 @@ import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Proxy;
|
||||
// ...
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
@ -420,6 +421,25 @@ public class DefaultRecordMapper<R extends Record, E> implements RecordMapper<R,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// [#7324] Map immutable Kotlin classes by parameter names if kotlin-reflect is on the classpath
|
||||
if (Tools.isKotlinAvailable() && !FALSE.equals(configuration.settings().isMapConstructorParameterNamesInKotlin())) {
|
||||
try {
|
||||
|
||||
@ -446,6 +446,10 @@ IDENTITY values, and if <returnAllOnUpdatableRecord/> is active, also other valu
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether JPA annotations should be considered by the DefaultRecordMapper.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="mapRecordComponentParameterNames" type="boolean" minOccurs="0" maxOccurs="1" default="true">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether constructor parameter names obtained from the {@link java.lang.Record} component names should be considered by the DefaultRecordMapper.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="mapConstructorPropertiesParameterNames" type="boolean" minOccurs="0" maxOccurs="1" default="true">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether constructor parameter names obtained from the {@link java.beans.ConstructorProperties} annotation should be considered by the DefaultRecordMapper.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user