mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - remove unused ScalarTypeConverter from BeanPropertyCompound (ala wrapper type like Option)
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.deploy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyCompound;
|
||||
import com.avaje.ebeaninternal.server.el.ElPropertyChainBuilder;
|
||||
@@ -19,6 +12,12 @@ import com.avaje.ebeaninternal.server.type.CtCompoundProperty;
|
||||
import com.avaje.ebeaninternal.server.type.CtCompoundPropertyElAdapter;
|
||||
import com.avaje.ebeaninternal.server.type.CtCompoundType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Property mapped to an Immutable Compound Value Object.
|
||||
* <p>
|
||||
@@ -30,12 +29,6 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
|
||||
private final CtCompoundType<?> compoundType;
|
||||
|
||||
/**
|
||||
* Type Converter for scala.Option and similar type wrapping.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private final ScalarTypeConverter typeConverter;
|
||||
|
||||
private final BeanProperty[] scalarProperties;
|
||||
|
||||
private final LinkedHashMap<String, BeanProperty> propertyMap = new LinkedHashMap<String, BeanProperty>();
|
||||
@@ -48,12 +41,9 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
public BeanPropertyCompound(BeanDescriptor<?> descriptor, DeployBeanPropertyCompound deploy) {
|
||||
|
||||
super(descriptor, deploy);
|
||||
|
||||
this.compoundType = deploy.getCompoundType();
|
||||
this.typeConverter = deploy.getTypeConverter();
|
||||
|
||||
BeanPropertyCompoundRoot root = deploy.getFlatProperties();
|
||||
|
||||
this.scalarProperties = root.getScalarProperties();
|
||||
|
||||
for (int i = 0; i < scalarProperties.length; i++) {
|
||||
@@ -139,11 +129,7 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
@Override
|
||||
public Object read(DbReadContext ctx) throws SQLException {
|
||||
|
||||
Object v = compoundType.read(ctx.getDataReader());
|
||||
if (typeConverter != null) {
|
||||
v = typeConverter.wrapValue(v);
|
||||
}
|
||||
return v;
|
||||
return compoundType.read(ctx.getDataReader());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-19
@@ -1,7 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.deploy;
|
||||
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
import com.avaje.ebeaninternal.server.type.CtCompoundProperty;
|
||||
|
||||
@@ -15,16 +14,10 @@ public class BeanPropertyCompoundScalar extends BeanProperty {
|
||||
|
||||
private final CtCompoundProperty ctProperty;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private final ScalarTypeConverter typeConverter;
|
||||
|
||||
public BeanPropertyCompoundScalar(BeanPropertyCompoundRoot rootProperty, DeployBeanProperty scalarDeploy,
|
||||
CtCompoundProperty ctProperty, ScalarTypeConverter<?, ?> typeConverter) {
|
||||
|
||||
public BeanPropertyCompoundScalar(BeanPropertyCompoundRoot rootProperty, DeployBeanProperty scalarDeploy, CtCompoundProperty ctProperty) {
|
||||
super(scalarDeploy);
|
||||
this.rootProperty = rootProperty;
|
||||
this.ctProperty = ctProperty;
|
||||
this.typeConverter = typeConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,20 +25,13 @@ public class BeanPropertyCompoundScalar extends BeanProperty {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValueObject(Object compoundValue) {
|
||||
if (typeConverter != null) {
|
||||
compoundValue = typeConverter.unwrapValue(compoundValue);
|
||||
}
|
||||
return ctProperty.getValue(compoundValue);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object getValue(EntityBean valueObject) {
|
||||
Object val = valueObject;
|
||||
if (typeConverter != null) {
|
||||
val = typeConverter.unwrapValue(val);
|
||||
}
|
||||
return ctProperty.getValue(val);
|
||||
return ctProperty.getValue(valueObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,9 +45,6 @@ public class BeanPropertyCompoundScalar extends BeanProperty {
|
||||
Object compoundValue = ctProperty.setValue(bean, value);
|
||||
|
||||
if (compoundValue != null) {
|
||||
if (typeConverter != null) {
|
||||
compoundValue = typeConverter.wrapValue(compoundValue);
|
||||
}
|
||||
// we are at the top level and we have a compound value
|
||||
// that we can set using the root property
|
||||
if (intercept) {
|
||||
|
||||
+4
-14
@@ -1,6 +1,5 @@
|
||||
package com.avaje.ebeaninternal.server.deploy.meta;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanPropertyCompoundRoot;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanPropertyCompoundScalar;
|
||||
import com.avaje.ebeaninternal.server.type.CtCompoundProperty;
|
||||
@@ -16,21 +15,17 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
public class DeployBeanPropertyCompound extends DeployBeanProperty {
|
||||
|
||||
final CtCompoundType<?> compoundType;
|
||||
private final CtCompoundType<?> compoundType;
|
||||
|
||||
final ScalarTypeConverter<?, ?> typeConverter;
|
||||
|
||||
DeployBeanEmbedded deployEmbedded;
|
||||
private DeployBeanEmbedded deployEmbedded;
|
||||
|
||||
/**
|
||||
* Create the property.
|
||||
*/
|
||||
public DeployBeanPropertyCompound(DeployBeanDescriptor<?> desc, Class<?> targetType,
|
||||
CtCompoundType<?> compoundType, ScalarTypeConverter<?, ?> typeConverter) {
|
||||
public DeployBeanPropertyCompound(DeployBeanDescriptor<?> desc, Class<?> targetType, CtCompoundType<?> compoundType) {
|
||||
|
||||
super(desc, targetType, null, null);
|
||||
this.compoundType = compoundType;
|
||||
this.typeConverter = typeConverter;
|
||||
}
|
||||
|
||||
public BeanPropertyCompoundRoot getFlatProperties() {
|
||||
@@ -71,8 +66,7 @@ public class DeployBeanPropertyCompound extends DeployBeanProperty {
|
||||
deploy.setDbUpdateable(true);
|
||||
deploy.setDbRead(true);
|
||||
|
||||
BeanPropertyCompoundScalar bp = new BeanPropertyCompoundScalar(rootProperty, deploy, ctProp, typeConverter);
|
||||
rootProperty.register(bp);
|
||||
rootProperty.register(new BeanPropertyCompoundScalar(rootProperty, deploy, ctProp));
|
||||
}
|
||||
|
||||
rootProperty.setNonScalarProperties(ctMeta.getNonScalarProperties());
|
||||
@@ -99,10 +93,6 @@ public class DeployBeanPropertyCompound extends DeployBeanProperty {
|
||||
return deployEmbedded;
|
||||
}
|
||||
|
||||
public ScalarTypeConverter<?, ?> getTypeConverter() {
|
||||
return typeConverter;
|
||||
}
|
||||
|
||||
public CtCompoundType<?> getCompoundType() {
|
||||
return compoundType;
|
||||
}
|
||||
|
||||
+2
-2
@@ -263,7 +263,7 @@ public class DeployCreateProperties {
|
||||
|
||||
CtCompoundType<?> compoundType = typeManager.getCompoundType(propertyType);
|
||||
if (compoundType != null) {
|
||||
return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null);
|
||||
return new DeployBeanPropertyCompound(desc, propertyType, compoundType);
|
||||
}
|
||||
|
||||
if (isTransientField(field)) {
|
||||
@@ -278,7 +278,7 @@ public class DeployCreateProperties {
|
||||
typeManager.recursiveCreateScalarDataReader(propertyType);
|
||||
compoundType = typeManager.getCompoundType(propertyType);
|
||||
if (compoundType != null) {
|
||||
return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null);
|
||||
return new DeployBeanPropertyCompound(desc, propertyType, compoundType);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user