#2359 - Rename plugin api methods with deprecation - Property

This commit is contained in:
rbygrave committed 2021-09-08 14:04:31 +12:00
1 parent bc02eeac57
commit 632f04c76b
66 files changed
+265 -193

No files matched your search

@@ -37,7 +37,15 @@ public interface ExpressionPath {
/** /**
* Return the default StringParser for the scalar property. * Return the default StringParser for the scalar property.
*/ */
StringParser getStringParser(); StringParser stringParser();
/**
* Deprecated migrate to stringParser().
*/
@Deprecated
default StringParser getStringParser() {
return stringParser();
}
/** /**
* For DateTime capable scalar types convert the long systemTimeMillis into * For DateTime capable scalar types convert the long systemTimeMillis into
@@ -54,7 +62,15 @@ public interface ExpressionPath {
/** /**
* Return the underlying JDBC type or 0 if this is not a scalar type. * Return the underlying JDBC type or 0 if this is not a scalar type.
*/ */
int getJdbcType(); int jdbcType();
/**
* Deprecated migrate to jdbcType().
*/
@Deprecated
default int getJdbcType() {
return jdbcType();
}
/** /**
* Return true if this is an ManyToOne or OneToOne associated bean property. * Return true if this is an ManyToOne or OneToOne associated bean property.
@@ -67,20 +83,52 @@ public interface ExpressionPath {
* Typically used to produce id = ? expression strings. * Typically used to produce id = ? expression strings.
* </p> * </p>
*/ */
String getAssocIdExpression(String propName, String bindOperator); String assocIdExpression(String propName, String bindOperator);
/**
* Deprecated migrate to assocIdExpression().
*/
@Deprecated
default String getAssocIdExpression(String propName, String bindOperator) {
return assocIdExpression(propName, bindOperator);
}
/** /**
* Return the Id values for the given bean value. * Return the Id values for the given bean value.
*/ */
Object[] getAssocIdValues(EntityBean bean); Object[] assocIdValues(EntityBean bean);
/**
* Deprecated migrate to assocIdValues().
*/
@Deprecated
default Object[] getAssocIdValues(EntityBean bean) {
return assocIdValues(bean);
}
/** /**
* Return the underlying bean property. * Return the underlying bean property.
*/ */
Property getProperty(); Property property();
/**
* Deprecated migrate to property().
*/
@Deprecated
default Property getProperty() {
return property();
}
/** /**
* The ElPrefix plus name. * The ElPrefix plus name.
*/ */
String getElName(); String elName();
/**
* Deprecated migrate to elName().
*/
@Deprecated
default String getElName() {
return elName();
}
} }
@@ -11,18 +11,42 @@ public interface Property {
* Return the name of the property. * Return the name of the property.
*/ */
@Nonnull @Nonnull
String getName(); String name();
/**
* Deprecated migrate to name().
*/
@Deprecated
default String getName() {
return name();
}
/** /**
* Return the type of the property. * Return the type of the property.
*/ */
@Nonnull @Nonnull
Class<?> getPropertyType(); Class<?> type();
/**
* Deprecated migrate to type().
*/
@Deprecated
default Class<?> getPropertyType() {
return type();
}
/** /**
* Return the value of the property on the given bean. * Return the value of the property on the given bean.
*/ */
Object getVal(Object bean); Object value(Object bean);
/**
* Deprecated migrate to value().
*/
@Deprecated
default Object getVal(Object bean) {
return value(bean);
}
/** /**
* Return true if this is a OneToMany or ManyToMany property. * Return true if this is a OneToMany or ManyToMany property.
@@ -76,7 +76,7 @@ public class ProfileOriginNodeUsage {
// (which is the default for Lob's so typical). // (which is the default for Lob's so typical).
} else { } else {
addedToPath = true; addedToPath = true;
pathProps.addToPath(path, beanProp.getName()); pathProps.addToPath(path, beanProp.name());
} }
} }
} }
@@ -86,14 +86,14 @@ public class ProfileOriginNodeUsage {
BeanProperty versionProp = desc.getVersionProperty(); BeanProperty versionProp = desc.getVersionProperty();
if (versionProp != null) { if (versionProp != null) {
addedToPath = true; addedToPath = true;
pathProps.addToPath(path, versionProp.getName()); pathProps.addToPath(path, versionProp.name());
} }
} }
if (toOneIdProperty != null && !addedToPath) { if (toOneIdProperty != null && !addedToPath) {
// add ToOne property to parent path // add ToOne property to parent path
ElPropertyValue assocOne = rootDesc.getElGetValue(path); ElPropertyValue assocOne = rootDesc.getElGetValue(path);
pathProps.addToPath(SplitName.parent(path), assocOne.getName()); pathProps.addToPath(SplitName.parent(path), assocOne.name());
} }
} finally { } finally {
lock.unlock(); lock.unlock();
@@ -52,7 +52,7 @@ public final class ManyWhereJoins implements Serializable {
String join = elProp.getElPrefix(); String join = elProp.getElPrefix();
BeanProperty p = elProp.getBeanProperty(); BeanProperty p = elProp.getBeanProperty();
if (p instanceof BeanPropertyAssocMany<?>) { if (p instanceof BeanPropertyAssocMany<?>) {
join = addManyToJoin(join, p.getName()); join = addManyToJoin(join, p.name());
} }
if (join != null) { if (join != null) {
addJoin(join); addJoin(join);
@@ -19,7 +19,7 @@ public final class CachedBeanDataFromBean {
if (idProperty != null) { if (idProperty != null) {
int propertyIndex = idProperty.getPropertyIndex(); int propertyIndex = idProperty.getPropertyIndex();
if (ebi.isLoadedProperty(propertyIndex)) { if (ebi.isLoadedProperty(propertyIndex)) {
data.put(idProperty.getName(), idProperty.getCacheDataValue(bean)); data.put(idProperty.name(), idProperty.getCacheDataValue(bean));
} }
} }
@@ -27,15 +27,15 @@ public final class CachedBeanDataFromBean {
final boolean dirty = ebi.isDirty(); final boolean dirty = ebi.isDirty();
for (BeanProperty prop : desc.propertiesNonMany()) { for (BeanProperty prop : desc.propertiesNonMany()) {
if (dirty && ebi.isDirtyProperty(prop.getPropertyIndex())) { if (dirty && ebi.isDirtyProperty(prop.getPropertyIndex())) {
data.put(prop.getName(), prop.getCacheDataValueOrig(ebi)); data.put(prop.name(), prop.getCacheDataValueOrig(ebi));
} else if (ebi.isLoadedProperty(prop.getPropertyIndex())) { } else if (ebi.isLoadedProperty(prop.getPropertyIndex())) {
data.put(prop.getName(), prop.getCacheDataValue(bean)); data.put(prop.name(), prop.getCacheDataValue(bean));
} }
} }
for (BeanPropertyAssocMany<?> prop : desc.propertiesMany()) { for (BeanPropertyAssocMany<?> prop : desc.propertiesMany()) {
if (prop.isElementCollection()) { if (prop.isElementCollection()) {
data.put(prop.getName(), prop.getCacheDataValue(bean)); data.put(prop.name(), prop.getCacheDataValue(bean));
} }
} }
@@ -36,9 +36,9 @@ public final class CachedBeanDataToBean {
} }
private static void loadProperty(EntityBean bean, CachedBeanData cacheBeanData, EntityBeanIntercept ebi, BeanProperty prop, PersistenceContext context) { private static void loadProperty(EntityBean bean, CachedBeanData cacheBeanData, EntityBeanIntercept ebi, BeanProperty prop, PersistenceContext context) {
if (cacheBeanData.isLoaded(prop.getName())) { if (cacheBeanData.isLoaded(prop.name())) {
if (!ebi.isLoadedProperty(prop.getPropertyIndex())) { if (!ebi.isLoadedProperty(prop.getPropertyIndex())) {
Object value = cacheBeanData.getData(prop.getName()); Object value = cacheBeanData.getData(prop.name());
prop.setCacheDataValue(bean, value, context); prop.setCacheDataValue(bean, value, context);
} }
} }
@@ -93,18 +93,18 @@ final class DefaultBeanLoader {
query.select(parentDesc.getIdBinder().getIdProperty()); query.select(parentDesc.getIdBinder().getIdProperty());
if (onlyIds) { if (onlyIds) {
query.fetch(many.getName(), many.getTargetIdProperty()); query.fetch(many.name(), many.getTargetIdProperty());
} else { } else {
query.fetch(many.getName()); query.fetch(many.name());
} }
if (filterMany != null) { if (filterMany != null) {
query.setFilterMany(many.getName(), filterMany); query.setFilterMany(many.name(), filterMany);
} }
query.where().idEq(parentId); query.where().idEq(parentId);
query.setBeanCacheMode(CacheMode.OFF); query.setBeanCacheMode(CacheMode.OFF);
query.setMode(Mode.LAZYLOAD_MANY); query.setMode(Mode.LAZYLOAD_MANY);
query.setLazyLoadManyPath(many.getName()); query.setLazyLoadManyPath(many.name());
query.setPersistenceContext(pc); query.setPersistenceContext(pc);
if (ebi.isReadOnly()) { if (ebi.isReadOnly()) {
query.setReadOnly(true); query.setReadOnly(true);
@@ -713,7 +713,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
} }
// we actually need to do a query because we don't know the type without the discriminator // we actually need to do a query because we don't know the type without the discriminator
// value, just select the id property and discriminator column (auto added) // value, just select the id property and discriminator column (auto added)
return find(type).select(idProp.getName()).setId(id).findOne(); return find(type).select(idProp.name()).setId(id).findOne();
} }
@Override @Override
@@ -2284,7 +2284,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
if (idProperty == null) { if (idProperty == null) {
return Collections.emptySet(); return Collections.emptySet();
} }
Object id = idProperty.getVal(entityBean); Object id = idProperty.value(entityBean);
if (entityBean._ebean_getIntercept().isNew() && id != null) { if (entityBean._ebean_getIntercept().isNew() && id != null) {
// Primary Key is changeable only on new models - so skip check if we are not new // Primary Key is changeable only on new models - so skip check if we are not new
Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory); Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory);
@@ -2311,14 +2311,14 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
ExpressionList<?> exprList = query.where(); ExpressionList<?> exprList = query.where();
if (!entityBean._ebean_getIntercept().isNew()) { if (!entityBean._ebean_getIntercept().isNew()) {
// if model is not new, exclude ourself. // if model is not new, exclude ourself.
exprList.ne(idProperty.getName(), idProperty.getVal(entityBean)); exprList.ne(idProperty.name(), idProperty.value(entityBean));
} }
for (Property prop : props) { for (Property prop : props) {
Object value = prop.getVal(entityBean); Object value = prop.value(entityBean);
if (value == null) { if (value == null) {
return null; return null;
} }
exprList.eq(prop.getName(), value); exprList.eq(prop.name(), value);
} }
if (findCount(query, transaction) > 0) { if (findCount(query, transaction) > 0) {
Set<Property> ret = new LinkedHashSet<>(); Set<Property> ret = new LinkedHashSet<>();
@@ -470,7 +470,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
if (mapKey == null) { if (mapKey == null) {
BeanProperty idProp = beanDescriptor.idProperty(); BeanProperty idProp = beanDescriptor.idProperty();
if (idProp != null) { if (idProp != null) {
query.setMapKey(idProp.getName()); query.setMapKey(idProp.name());
} else { } else {
throw new PersistenceException("No mapKey specified for query"); throw new PersistenceException("No mapKey specified for query");
} }
@@ -1341,7 +1341,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
BeanProperty property = beanDescriptor.propertyByIndex(i); BeanProperty property = beanDescriptor.propertyByIndex(i);
if (property.isCacheDataInclude()) { if (property.isCacheDataInclude()) {
Object val = property.getCacheDataValue(bean); Object val = property.getCacheDataValue(bean);
changes.put(property.getName(), val); changes.put(property.name(), val);
if (property.isNaturalKey()) { if (property.isNaturalKey()) {
updateNaturalKey = true; updateNaturalKey = true;
String valStr = (val == null) ? null : val.toString(); String valStr = (val == null) ? null : val.toString();
@@ -22,7 +22,7 @@ final class AssocOneHelpRefExported extends AssocOneHelp {
@Override @Override
void appendSelect(DbSqlContext ctx, boolean subQuery) { void appendSelect(DbSqlContext ctx, boolean subQuery) {
// set appropriate tableAlias for the exported id columns // set appropriate tableAlias for the exported id columns
String relativePrefix = ctx.getRelativePrefix(property.getName()); String relativePrefix = ctx.getRelativePrefix(property.name());
ctx.pushTableAlias(relativePrefix); ctx.pushTableAlias(relativePrefix);
property.targetIdBinder.appendSelect(ctx, subQuery); property.targetIdBinder.appendSelect(ctx, subQuery);
ctx.popTableAlias(); ctx.popTableAlias();
@@ -30,7 +30,7 @@ final class AssocOneHelpRefExported extends AssocOneHelp {
@Override @Override
void appendFrom(DbSqlContext ctx, SqlJoinType joinType) { void appendFrom(DbSqlContext ctx, SqlJoinType joinType) {
String relativePrefix = ctx.getRelativePrefix(property.getName()); String relativePrefix = ctx.getRelativePrefix(property.name());
if (softDelete && !ctx.isIncludeSoftDelete()) { if (softDelete && !ctx.isIncludeSoftDelete()) {
property.tableJoin.addJoin(joinType, relativePrefix, ctx, softDeletePredicate); property.tableJoin.addJoin(joinType, relativePrefix, ctx, softDeletePredicate);
} else { } else {
@@ -70,7 +70,7 @@ final class AssocOneHelpRefInherit extends AssocOneHelp {
void appendSelect(DbSqlContext ctx, boolean subQuery) { void appendSelect(DbSqlContext ctx, boolean subQuery) {
if (!subQuery) { if (!subQuery) {
// add discriminator column // add discriminator column
String relativePrefix = ctx.getRelativePrefix(property.getName()); String relativePrefix = ctx.getRelativePrefix(property.name());
String tableAlias = ctx.getTableAlias(relativePrefix); String tableAlias = ctx.getTableAlias(relativePrefix);
ctx.appendColumn(tableAlias, property.targetInheritInfo.getDiscriminatorColumn()); ctx.appendColumn(tableAlias, property.targetInheritInfo.getDiscriminatorColumn());
} }
@@ -18,7 +18,7 @@ abstract class BaseCollectionHelp<T> implements BeanCollectionHelp<T> {
BaseCollectionHelp(BeanPropertyAssocMany<T> many) { BaseCollectionHelp(BeanPropertyAssocMany<T> many) {
this.many = many; this.many = many;
this.targetDescriptor = many.getTargetDescriptor(); this.targetDescriptor = many.getTargetDescriptor();
this.propertyName = many.getName(); this.propertyName = many.name();
} }
BaseCollectionHelp() { BaseCollectionHelp() {
@@ -55,9 +55,9 @@ final class BeanChangeJson implements BeanDiffVisitor {
stack.push(descriptor); stack.push(descriptor);
BeanPropertyAssocOne<?> embedded = (BeanPropertyAssocOne<?>)descriptor.propertiesIndex[position]; BeanPropertyAssocOne<?> embedded = (BeanPropertyAssocOne<?>)descriptor.propertiesIndex[position];
descriptor = embedded.getTargetDescriptor(); descriptor = embedded.getTargetDescriptor();
newJson.writeStartObject(embedded.getName()); newJson.writeStartObject(embedded.name());
if (oldJson != null) { if (oldJson != null) {
oldJson.writeStartObject(embedded.getName()); oldJson.writeStartObject(embedded.name());
} }
} }
@@ -380,8 +380,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
this.propertiesIndex = new BeanProperty[0]; this.propertiesIndex = new BeanProperty[0];
} else { } else {
EntityBeanIntercept ebi = prototypeEntityBean._ebean_getIntercept(); EntityBeanIntercept ebi = prototypeEntityBean._ebean_getIntercept();
this.idPropertyIndex = (idProperty == null) ? -1 : ebi.findProperty(idProperty.getName()); this.idPropertyIndex = (idProperty == null) ? -1 : ebi.findProperty(idProperty.name());
this.versionPropertyIndex = (versionProperty == null) ? -1 : ebi.findProperty(versionProperty.getName()); this.versionPropertyIndex = (versionProperty == null) ? -1 : ebi.findProperty(versionProperty.name());
this.unloadProperties = derivePropertiesToUnload(prototypeEntityBean); this.unloadProperties = derivePropertiesToUnload(prototypeEntityBean);
this.propertiesIndex = new BeanProperty[ebi.getPropertyLength()]; this.propertiesIndex = new BeanProperty[ebi.getPropertyLength()];
for (int i = 0; i < propertiesIndex.length; i++) { for (int i = 0; i < propertiesIndex.length; i++) {
@@ -913,7 +913,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* foreign keys don't require an extra join. * foreign keys don't require an extra join.
*/ */
public void add(BeanFkeyProperty fkey) { public void add(BeanFkeyProperty fkey) {
elDeployCache.put(fkey.getName(), fkey); elDeployCache.put(fkey.name(), fkey);
} }
void initialiseFkeys() { void initialiseFkeys() {
@@ -1639,7 +1639,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
public BeanPropertyAssocMany<?> getManyProperty(SpiQuery<?> query) { public BeanPropertyAssocMany<?> getManyProperty(SpiQuery<?> query) {
OrmQueryDetail detail = query.getDetail(); OrmQueryDetail detail = query.getDetail();
for (BeanPropertyAssocMany<?> many : propertiesMany) { for (BeanPropertyAssocMany<?> many : propertiesMany) {
if (detail.includesPath(many.getName())) { if (detail.includesPath(many.name())) {
return many; return many;
} }
} }
@@ -2094,7 +2094,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the Id property name or null if no Id property exists. * Return the Id property name or null if no Id property exists.
*/ */
public String getIdName() { public String getIdName() {
return (idProperty == null) ? null : idProperty.getName(); return (idProperty == null) ? null : idProperty.name();
} }
/** /**
@@ -2220,7 +2220,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
if (!ebi.isLoadedProperty(many.getPropertyIndex())) { if (!ebi.isLoadedProperty(many.getPropertyIndex())) {
BeanCollection<?> ref = many.createReferenceIfNull(bean); BeanCollection<?> ref = many.createReferenceIfNull(bean);
if (ref != null && !ref.isRegisteredWithLoadContext()) { if (ref != null && !ref.isRegisteredWithLoadContext()) {
String path = SplitName.add(prefix, many.getName()); String path = SplitName.add(prefix, many.name());
loadContext.register(path, many, ref); loadContext.register(path, many, ref);
} }
} }
@@ -2416,7 +2416,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
if (assocProperty != null) { if (assocProperty != null) {
String relativePath = assocProperty.getTargetDescriptor().findBeanPath(schemaName, tableName, columnName); String relativePath = assocProperty.getTargetDescriptor().findBeanPath(schemaName, tableName, columnName);
if (relativePath != null) { if (relativePath != null) {
return SplitName.add(assocProperty.getName(), relativePath); return SplitName.add(assocProperty.name(), relativePath);
} }
} }
return null; return null;
@@ -2825,7 +2825,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
@Override @Override
public void inheritanceLoad(SqlBeanLoad sqlBeanLoad, STreeProperty property, DbReadContext ctx) { public void inheritanceLoad(SqlBeanLoad sqlBeanLoad, STreeProperty property, DbReadContext ctx) {
BeanProperty p = getBeanProperty(property.getName()); BeanProperty p = getBeanProperty(property.name());
if (p != null) { if (p != null) {
p.load(sqlBeanLoad); p.load(sqlBeanLoad);
} else { } else {
@@ -3026,7 +3026,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
final Set<String> included = rootProps.getIncluded(); final Set<String> included = rootProps.getIncluded();
if (included != null) { if (included != null) {
for (BeanProperty property : propertiesAggregate) { for (BeanProperty property : propertiesAggregate) {
if (included.contains(property.getName())) { if (included.contains(property.name())) {
return true; return true;
} }
} }
@@ -3176,8 +3176,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* provides unique ordering of the rows (so that the paging is predicable). * provides unique ordering of the rows (so that the paging is predicable).
*/ */
public void appendOrderById(SpiQuery<T> query) { public void appendOrderById(SpiQuery<T> query) {
if (idProperty != null && !idProperty.isEmbedded() && !query.order().containsProperty(idProperty.getName())) { if (idProperty != null && !idProperty.isEmbedded() && !query.order().containsProperty(idProperty.name())) {
query.order().asc(idProperty.getName()); query.order().asc(idProperty.name());
} }
} }
@@ -282,7 +282,7 @@ final class BeanDescriptorCacheHelp<T> {
// held as part of the bean cache so skip // held as part of the bean cache so skip
return false; return false;
} }
CachedManyIds entry = manyPropGet(parentId, many.getName()); CachedManyIds entry = manyPropGet(parentId, many.name());
if (entry == null) { if (entry == null) {
// not in cache so return unsuccessful // not in cache so return unsuccessful
return false; return false;
@@ -316,7 +316,7 @@ final class BeanDescriptorCacheHelp<T> {
// add as JSON to bean cache // add as JSON to bean cache
String asJson = many.jsonWriteCollection(details); String asJson = many.jsonWriteCollection(details);
Map<String, Object> changes = new HashMap<>(); Map<String, Object> changes = new HashMap<>();
changes.put(many.getName(), asJson); changes.put(many.name(), asJson);
CachedBeanData newData = data.update(changes, data.getVersion()); CachedBeanData newData = data.update(changes, data.getVersion());
if (beanLog.isDebugEnabled()) { if (beanLog.isDebugEnabled()) {
@@ -330,7 +330,7 @@ final class BeanDescriptorCacheHelp<T> {
} else { } else {
CachedManyIds entry = createManyIds(many, details); CachedManyIds entry = createManyIds(many, details);
if (entry != null) { if (entry != null) {
cachePutManyIds(parentId, many.getName(), entry); cachePutManyIds(parentId, many.name(), entry);
} }
} }
} }
@@ -845,7 +845,7 @@ final class BeanDescriptorCacheHelp<T> {
Object details = many.getValue(updateRequest.entityBean()); Object details = many.getValue(updateRequest.entityBean());
CachedManyIds entry = createManyIds(many, details); CachedManyIds entry = createManyIds(many, details);
if (entry != null) { if (entry != null) {
changeSet.addManyPut(desc, many.getName(), id, entry); changeSet.addManyPut(desc, many.name(), id, entry);
} }
} }
} }
@@ -87,12 +87,12 @@ final class BeanDescriptorDraftHelp<T> {
void draftQueryOptimise(Query<T> query) { void draftQueryOptimise(Query<T> query) {
for (BeanPropertyAssocOne<?> anOne : desc.propertiesOne()) { for (BeanPropertyAssocOne<?> anOne : desc.propertiesOne()) {
if (anOne.getTargetDescriptor().isDraftableElement()) { if (anOne.getTargetDescriptor().isDraftableElement()) {
query.fetch(anOne.getName()); query.fetch(anOne.name());
} }
} }
for (BeanPropertyAssocMany<?> aMany : desc.propertiesMany()) { for (BeanPropertyAssocMany<?> aMany : desc.propertiesMany()) {
if (aMany.getTargetDescriptor().isDraftableElement()) { if (aMany.getTargetDescriptor().isDraftableElement()) {
query.fetch(aMany.getName()); query.fetch(aMany.name());
} }
} }
} }
@@ -34,7 +34,7 @@ final class BeanEmbeddedMetaFactory {
BeanProperty[] embeddedProperties = new BeanProperty[sourceProperties.length]; BeanProperty[] embeddedProperties = new BeanProperty[sourceProperties.length];
for (int i = 0; i < sourceProperties.length; i++) { for (int i = 0; i < sourceProperties.length; i++) {
String propertyName = sourceProperties[i].getName(); String propertyName = sourceProperties[i].name();
Column column = propColMap.get(propertyName); Column column = propColMap.get(propertyName);
String dbColumn = dbColumn(columnPrefix, column, sourceProperties[i]); String dbColumn = dbColumn(columnPrefix, column, sourceProperties[i]);
boolean dbNullable = dbNullable(column, sourceProperties[i]); boolean dbNullable = dbNullable(column, sourceProperties[i]);
@@ -106,12 +106,12 @@ public final class BeanFkeyProperty implements ElPropertyValue {
} }
@Override @Override
public String getName() { public String name() {
return name; return name;
} }
@Override @Override
public String getElName() { public String elName() {
return name; return name;
} }
@@ -119,7 +119,7 @@ public final class BeanFkeyProperty implements ElPropertyValue {
* Returns null as not an AssocOne. * Returns null as not an AssocOne.
*/ */
@Override @Override
public Object[] getAssocIdValues(EntityBean value) { public Object[] assocIdValues(EntityBean value) {
return null; return null;
} }
@@ -127,7 +127,7 @@ public final class BeanFkeyProperty implements ElPropertyValue {
* Returns null as not an AssocOne. * Returns null as not an AssocOne.
*/ */
@Override @Override
public String getAssocIdExpression(String prefix, String operator) { public String assocIdExpression(String prefix, String operator) {
return null; return null;
} }
@@ -186,7 +186,7 @@ public final class BeanFkeyProperty implements ElPropertyValue {
} }
@Override @Override
public int getJdbcType() { public int jdbcType() {
return 0; return 0;
} }
@@ -201,7 +201,7 @@ public final class BeanFkeyProperty implements ElPropertyValue {
} }
@Override @Override
public StringParser getStringParser() { public StringParser stringParser() {
throw new RuntimeException("ElPropertyDeploy only - not implemented"); throw new RuntimeException("ElPropertyDeploy only - not implemented");
} }
@@ -226,7 +226,7 @@ public final class BeanFkeyProperty implements ElPropertyValue {
} }
@Override @Override
public Property getProperty() { public Property property() {
throw new RuntimeException("ElPropertyDeploy only - not implemented"); throw new RuntimeException("ElPropertyDeploy only - not implemented");
} }
@@ -30,7 +30,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
BeanMapHelp(BeanPropertyAssocMany<T> many) { BeanMapHelp(BeanPropertyAssocMany<T> many) {
this.many = many; this.many = many;
this.targetDescriptor = many.getTargetDescriptor(); this.targetDescriptor = many.getTargetDescriptor();
this.propertyName = many.getName(); this.propertyName = many.name();
this.beanProperty = targetDescriptor.getBeanProperty(many.getMapKey()); this.beanProperty = targetDescriptor.getBeanProperty(many.getMapKey());
} }
@@ -284,7 +284,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
protected BeanProperty(BeanProperty source, BeanPropertyOverride override) { protected BeanProperty(BeanProperty source, BeanPropertyOverride override) {
this.descriptor = source.descriptor; this.descriptor = source.descriptor;
this.propertyIndex = source.propertyIndex; this.propertyIndex = source.propertyIndex;
this.name = source.getName(); this.name = source.name();
this.dbColumn = override.getDbColumn(); this.dbColumn = override.getDbColumn();
this.nullable = override.isDbNullable(); this.nullable = override.isDbNullable();
this.dbLength = override.getDbLength(); this.dbLength = override.getDbLength();
@@ -337,7 +337,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
this.dbType = source.getDbType(true); this.dbType = source.getDbType(true);
this.scalarType = source.scalarType; this.scalarType = source.scalarType;
this.lob = isLobType(dbType); this.lob = isLobType(dbType);
this.propertyType = source.getPropertyType(); this.propertyType = source.type();
this.field = source.getField(); this.field = source.getField();
this.docOptions = source.docOptions; this.docOptions = source.docOptions;
this.unmappedJson = source.unmappedJson; this.unmappedJson = source.unmappedJson;
@@ -356,7 +356,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
public void initialise(BeanDescriptorInitContext initContext) { public void initialise(BeanDescriptorInitContext initContext) {
// do nothing for normal BeanProperty // do nothing for normal BeanProperty
if (!isTransient && scalarType == null) { if (!isTransient && scalarType == null) {
throw new RuntimeException("No ScalarType assigned to " + descriptor.fullName() + "." + getName()); throw new RuntimeException("No ScalarType assigned to " + descriptor.fullName() + "." + name());
} }
} }
@@ -572,7 +572,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public Property getProperty() { public Property property() {
return this; return this;
} }
@@ -756,7 +756,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public Object getVal(Object bean) { public Object value(Object bean) {
return getValue((EntityBean) bean); return getValue((EntityBean) bean);
} }
@@ -817,7 +817,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
*/ */
@Override @Override
@Nonnull @Nonnull
public String getName() { public String name() {
return name; return name;
} }
@@ -829,7 +829,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public String getElName() { public String elName() {
return name; return name;
} }
@@ -855,13 +855,13 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public Object[] getAssocIdValues(EntityBean bean) { public Object[] assocIdValues(EntityBean bean) {
// Returns null as not an AssocOne. // Returns null as not an AssocOne.
return null; return null;
} }
@Override @Override
public String getAssocIdExpression(String prefix, String operator) { public String assocIdExpression(String prefix, String operator) {
// Returns null as not an AssocOne. // Returns null as not an AssocOne.
return null; return null;
} }
@@ -939,7 +939,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public StringParser getStringParser() { public StringParser stringParser() {
return scalarType; return scalarType;
} }
@@ -949,7 +949,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
} }
@Override @Override
public int getJdbcType() { public int jdbcType() {
return scalarType == null ? 0 : scalarType.getJdbcType(); return scalarType == null ? 0 : scalarType.getJdbcType();
} }
@@ -1303,7 +1303,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
*/ */
@Override @Override
@Nonnull @Nonnull
public Class<?> getPropertyType() { public Class<?> type() {
return propertyType; return propertyType;
} }
@@ -177,7 +177,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
if (childMasterProperty != null) { if (childMasterProperty != null) {
BeanProperty masterId = childMasterProperty.getTargetDescriptor().idProperty(); BeanProperty masterId = childMasterProperty.getTargetDescriptor().idProperty();
if (masterId != null) { // in docstore only, the master-id may be not available if (masterId != null) { // in docstore only, the master-id may be not available
childMasterIdProperty = childMasterProperty.getName() + "." + masterId.getName(); childMasterIdProperty = childMasterProperty.name() + "." + masterId.name();
} }
} }
} }
@@ -209,7 +209,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public Collection getRawCollection(EntityBean bean) { public Collection getRawCollection(EntityBean bean) {
return help.underlying(getVal(bean)); return help.underlying(value(bean));
} }
/** /**
@@ -217,11 +217,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
*/ */
@Override @Override
public void merge(EntityBean bean, EntityBean existing) { public void merge(EntityBean bean, EntityBean existing) {
Object existingCollection = getVal(existing); Object existingCollection = value(existing);
if (existingCollection instanceof BeanCollection<?>) { if (existingCollection instanceof BeanCollection<?>) {
BeanCollection<?> toBC = (BeanCollection<?>) existingCollection; BeanCollection<?> toBC = (BeanCollection<?>) existingCollection;
if (!toBC.isPopulated()) { if (!toBC.isPopulated()) {
Object fromCollection = getVal(bean); Object fromCollection = value(bean);
if (fromCollection instanceof BeanCollection<?>) { if (fromCollection instanceof BeanCollection<?>) {
BeanCollection<?> fromBC = (BeanCollection<?>) fromCollection; BeanCollection<?> fromBC = (BeanCollection<?>) fromCollection;
if (fromBC.isPopulated()) { if (fromBC.isPopulated()) {
@@ -454,7 +454,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
* Return the Id values from the given bean. * Return the Id values from the given bean.
*/ */
@Override @Override
public Object[] getAssocIdValues(EntityBean bean) { public Object[] assocIdValues(EntityBean bean) {
return targetDescriptor.getIdBinder().getIdValues(bean); return targetDescriptor.getIdBinder().getIdValues(bean);
} }
@@ -462,7 +462,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
* Return the Id expression to add to where clause etc. * Return the Id expression to add to where clause etc.
*/ */
@Override @Override
public String getAssocIdExpression(String prefix, String operator) { public String assocIdExpression(String prefix, String operator) {
return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator); return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator);
} }
@@ -702,7 +702,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
for (BeanPropertyAssocOne<?> prop : targetDesc.propertiesOne()) { for (BeanPropertyAssocOne<?> prop : targetDesc.propertiesOne()) {
if (mappedBy != null) { if (mappedBy != null) {
// match using mappedBy as property name // match using mappedBy as property name
if (mappedBy.equalsIgnoreCase(prop.getName())) { if (mappedBy.equalsIgnoreCase(prop.name())) {
return prop; return prop;
} }
} else { } else {
@@ -723,7 +723,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
// search for the property // search for the property
BeanDescriptor<?> targetDesc = getTargetDescriptor(); BeanDescriptor<?> targetDesc = getTargetDescriptor();
for (BeanProperty prop : targetDesc.propertiesAll()) { for (BeanProperty prop : targetDesc.propertiesAll()) {
if (mapKey.equalsIgnoreCase(prop.getName())) { if (mapKey.equalsIgnoreCase(prop.name())) {
return prop; return prop;
} }
} }
@@ -79,7 +79,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
embeddedProps = overrideMeta.getProperties(); embeddedProps = overrideMeta.getProperties();
embeddedPropsMap = new HashMap<>(); embeddedPropsMap = new HashMap<>();
for (BeanProperty embeddedProp : embeddedProps) { for (BeanProperty embeddedProp : embeddedProps) {
embeddedPropsMap.put(embeddedProp.getName(), embeddedProp); embeddedPropsMap.put(embeddedProp.name(), embeddedProp);
} }
} else { } else {
embeddedProps = null; embeddedProps = null;
@@ -175,13 +175,13 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
*/ */
void cacheClear() { void cacheClear() {
if (cacheNotifyRelationship) { if (cacheNotifyRelationship) {
targetDescriptor.cacheManyPropClear(relationshipProperty.getName()); targetDescriptor.cacheManyPropClear(relationshipProperty.name());
} }
} }
void cacheClear(CacheChangeSet changeSet) { void cacheClear(CacheChangeSet changeSet) {
if (cacheNotifyRelationship) { if (cacheNotifyRelationship) {
changeSet.addManyClear(targetDescriptor, relationshipProperty.getName()); changeSet.addManyClear(targetDescriptor, relationshipProperty.name());
} }
} }
@@ -191,13 +191,13 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
void cacheDelete(boolean clear, EntityBean bean, CacheChangeSet changeSet) { void cacheDelete(boolean clear, EntityBean bean, CacheChangeSet changeSet) {
if (cacheNotifyRelationship) { if (cacheNotifyRelationship) {
if (clear) { if (clear) {
changeSet.addManyClear(targetDescriptor, relationshipProperty.getName()); changeSet.addManyClear(targetDescriptor, relationshipProperty.name());
} else { } else {
Object assocBean = getValue(bean); Object assocBean = getValue(bean);
if (assocBean != null) { if (assocBean != null) {
Object parentId = targetDescriptor.id(assocBean); Object parentId = targetDescriptor.id(assocBean);
if (parentId != null) { if (parentId != null) {
changeSet.addManyRemove(targetDescriptor, relationshipProperty.getName(), parentId); changeSet.addManyRemove(targetDescriptor, relationshipProperty.name(), parentId);
} }
} }
} }
@@ -268,7 +268,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
private List<Object> findIdsByParentId(Object parentId, Transaction t) { private List<Object> findIdsByParentId(Object parentId, Transaction t) {
String rawWhere = deriveWhereParentIdSql(false); String rawWhere = deriveWhereParentIdSql(false);
SpiEbeanServer server = server(); SpiEbeanServer server = server();
Query<?> q = server.find(getPropertyType()); Query<?> q = server.find(type());
bindParentIdEq(rawWhere, parentId, q); bindParentIdEq(rawWhere, parentId, q);
return server.findIds(q, t); return server.findIds(q, t);
} }
@@ -278,7 +278,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
String inClause = getIdBinder().getIdInValueExpr(false, parentIds.size()); String inClause = getIdBinder().getIdInValueExpr(false, parentIds.size());
String expr = rawWhere + inClause; String expr = rawWhere + inClause;
SpiEbeanServer server = server(); SpiEbeanServer server = server();
Query<?> q = server.find(getPropertyType()); Query<?> q = server.find(type());
bindParentIdsIn(expr, parentIds, q); bindParentIdsIn(expr, parentIds, q);
return server.findIds(q, t); return server.findIds(q, t);
} }
@@ -301,7 +301,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
String basePath = SplitName.add(prefix, name); String basePath = SplitName.add(prefix, name);
if (dbColumn != null) { if (dbColumn != null) {
BeanProperty idProperty = target.idProperty(); BeanProperty idProperty = target.idProperty();
desc.registerColumn(dbColumn, SplitName.add(basePath, idProperty.getName())); desc.registerColumn(dbColumn, SplitName.add(basePath, idProperty.name()));
} }
desc.registerTable(target.baseTable(), this); desc.registerTable(target.baseTable(), this);
} }
@@ -399,7 +399,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
*/ */
@Override @Override
public Class<?> getTargetType() { public Class<?> getTargetType() {
return getPropertyType(); return type();
} }
/** /**
@@ -485,7 +485,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
* Return the Id values from the given bean. * Return the Id values from the given bean.
*/ */
@Override @Override
public Object[] getAssocIdValues(EntityBean bean) { public Object[] assocIdValues(EntityBean bean) {
return targetDescriptor.getIdBinder().getIdValues(bean); return targetDescriptor.getIdBinder().getIdValues(bean);
} }
@@ -493,7 +493,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
* Return the Id expression to add to where clause etc. * Return the Id expression to add to where clause etc.
*/ */
@Override @Override
public String getAssocIdExpression(String prefix, String operator) { public String assocIdExpression(String prefix, String operator) {
return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator); return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator);
} }
@@ -24,7 +24,7 @@ abstract class DynamicPropertyBase implements STreeProperty {
} }
@Override @Override
public String getName() { public String name() {
return name; return name;
} }
@@ -54,6 +54,6 @@ final class ExportedProperty {
if (path != null) { if (path != null) {
sb.append(path).append("."); sb.append(path).append(".");
} }
sb.append(property.getName()); sb.append(property.name());
} }
} }
@@ -35,7 +35,7 @@ public final class IdBinderEmbedded implements IdBinder {
public IdBinderEmbedded(boolean idInExpandedForm, BeanPropertyAssocOne<?> embIdProperty) { public IdBinderEmbedded(boolean idInExpandedForm, BeanPropertyAssocOne<?> embIdProperty) {
this.idInExpandedForm = idInExpandedForm; this.idInExpandedForm = idInExpandedForm;
this.embIdProperty = embIdProperty; this.embIdProperty = embIdProperty;
this.idClass = "_idClass".equals(embIdProperty.getName()); this.idClass = "_idClass".equals(embIdProperty.name());
} }
@Override @Override
@@ -91,9 +91,9 @@ public final class IdBinderEmbedded implements IdBinder {
sb.append(pathPrefix).append("."); sb.append(pathPrefix).append(".");
} }
if (!idClass) { if (!idClass) {
sb.append(embIdProperty.getName()).append("."); sb.append(embIdProperty.name()).append(".");
} }
sb.append(props[i].getName()); sb.append(props[i].name());
if (!ascending) { if (!ascending) {
sb.append(" desc"); sb.append(" desc");
} }
@@ -107,13 +107,13 @@ public final class IdBinderEmbedded implements IdBinder {
@Override @Override
public String getIdProperty() { public String getIdProperty() {
return embIdProperty.getName(); return embIdProperty.name();
} }
@Override @Override
public void buildRawSqlSelectChain(String prefix, List<String> selectChain) { public void buildRawSqlSelectChain(String prefix, List<String> selectChain) {
if (!idClass) { if (!idClass) {
prefix = SplitName.add(prefix, embIdProperty.getName()); prefix = SplitName.add(prefix, embIdProperty.name());
} }
for (BeanProperty prop : props) { for (BeanProperty prop : props) {
prop.buildRawSqlSelectChain(prefix, selectChain); prop.buildRawSqlSelectChain(prefix, selectChain);
@@ -143,9 +143,9 @@ public final class IdBinderEmbedded implements IdBinder {
sb.append(", "); sb.append(", ");
} }
if (!idClass) { if (!idClass) {
sb.append(embIdProperty.getName()).append("."); sb.append(embIdProperty.name()).append(".");
} }
sb.append(props[i].getName()); sb.append(props[i].name());
} }
return sb.toString(); return sb.toString();
} }
@@ -235,7 +235,7 @@ public final class IdBinderEmbedded implements IdBinder {
EntityBean ebValue = (EntityBean) embIdProperty.getValue(bean); EntityBean ebValue = (EntityBean) embIdProperty.getValue(bean);
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
for (BeanProperty prop : props) { for (BeanProperty prop : props) {
map.put(prop.getName(), prop.getValue(ebValue)); map.put(prop.name(), prop.getValue(ebValue));
} }
return map; return map;
} }
@@ -249,7 +249,7 @@ public final class IdBinderEmbedded implements IdBinder {
Map<String, Object> map = (Map<String, Object>) value; Map<String, Object> map = (Map<String, Object>) value;
EntityBean idValue = idDesc.createEntityBean(); EntityBean idValue = idDesc.createEntityBean();
for (BeanProperty prop : props) { for (BeanProperty prop : props) {
prop.setValue(idValue, map.get(prop.getName())); prop.setValue(idValue, map.get(prop.name()));
} }
return idValue; return idValue;
} }
@@ -358,7 +358,7 @@ public final class IdBinderEmbedded implements IdBinder {
if (prefix != null) { if (prefix != null) {
sb.append(prefix).append("."); sb.append(prefix).append(".");
} }
sb.append(props[i].getName()); sb.append(props[i].name());
} }
sb.append(")"); sb.append(")");
return sb.toString(); return sb.toString();
@@ -375,9 +375,9 @@ public final class IdBinderEmbedded implements IdBinder {
sb.append(prefix).append("."); sb.append(prefix).append(".");
} }
if (!idClass) { if (!idClass) {
sb.append(embIdProperty.getName()).append("."); sb.append(embIdProperty.name()).append(".");
} }
sb.append(props[i].getName()).append(operator); sb.append(props[i].name()).append(operator);
} }
return sb.toString(); return sb.toString();
} }
@@ -35,7 +35,7 @@ public final class IdBinderSimple implements IdBinder {
public IdBinderSimple(BeanProperty idProperty, MultiValueBind multiValueBind) { public IdBinderSimple(BeanProperty idProperty, MultiValueBind multiValueBind) {
this.idProperty = idProperty; this.idProperty = idProperty;
this.scalarType = idProperty.getScalarType(); this.scalarType = idProperty.getScalarType();
this.expectedType = idProperty.getPropertyType(); this.expectedType = idProperty.type();
bindIdSql = InternString.intern(idProperty.getDbColumn() + " = ? "); bindIdSql = InternString.intern(idProperty.getDbColumn() + " = ? ");
this.multiValueBind = multiValueBind; this.multiValueBind = multiValueBind;
} }
@@ -56,7 +56,7 @@ public final class IdBinderSimple implements IdBinder {
if (pathPrefix != null) { if (pathPrefix != null) {
sb.append(pathPrefix).append("."); sb.append(pathPrefix).append(".");
} }
sb.append(idProperty.getName()); sb.append(idProperty.name());
if (!ascending) { if (!ascending) {
sb.append(" desc"); sb.append(" desc");
} }
@@ -75,7 +75,7 @@ public final class IdBinderSimple implements IdBinder {
@Override @Override
public String getIdProperty() { public String getIdProperty() {
return idProperty.getName(); return idProperty.name();
} }
@Override @Override
@@ -93,7 +93,7 @@ public final class IdBinderSimple implements IdBinder {
@Override @Override
public String getDefaultOrderBy() { public String getDefaultOrderBy() {
return idProperty.getName(); return idProperty.name();
} }
@Override @Override
@@ -216,7 +216,7 @@ public final class IdBinderSimple implements IdBinder {
sb.append(prefix); sb.append(prefix);
sb.append("."); sb.append(".");
} }
sb.append(idProperty.getName()); sb.append(idProperty.name());
sb.append(operator); sb.append(operator);
return sb.toString(); return sb.toString();
} }
@@ -228,7 +228,7 @@ public final class IdBinderSimple implements IdBinder {
sb.append(prefix); sb.append(prefix);
sb.append("."); sb.append(".");
} }
sb.append(idProperty.getName()); sb.append(idProperty.name());
return sb.toString(); return sb.toString();
} }
@@ -34,7 +34,7 @@ public final class ImportedIdEmbedded implements ImportedId {
public void addFkeys(String name) { public void addFkeys(String name) {
BeanProperty[] embeddedProps = foreignAssocOne.getProperties(); BeanProperty[] embeddedProps = foreignAssocOne.getProperties();
for (int i = 0; i < imported.length; i++) { for (int i = 0; i < imported.length; i++) {
String n = name + "." + foreignAssocOne.getName() + "." + embeddedProps[i].getName(); String n = name + "." + foreignAssocOne.name() + "." + embeddedProps[i].name();
BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder()); BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder());
owner.getBeanDescriptor().add(fkey); owner.getBeanDescriptor().add(fkey);
} }
@@ -88,7 +88,7 @@ public final class ImportedIdSimple implements ImportedId, Comparable<ImportedId
@Override @Override
public void addFkeys(String name) { public void addFkeys(String name) {
BeanFkeyProperty fkey = new BeanFkeyProperty(name + "." + foreignProperty.getName(), localDbColumn, owner.getDeployOrder()); BeanFkeyProperty fkey = new BeanFkeyProperty(name + "." + foreignProperty.name(), localDbColumn, owner.getDeployOrder());
owner.getBeanDescriptor().add(fkey); owner.getBeanDescriptor().add(fkey);
} }
@@ -90,7 +90,7 @@ public final class DeployBeanPropertyLists {
discProperty = null; discProperty = null;
} }
BeanProperty beanProp = createBeanProperty(owner, prop); BeanProperty beanProp = createBeanProperty(owner, prop);
propertyMap.put(beanProp.getName(), beanProp); propertyMap.put(beanProp.name(), beanProp);
} }
int order = 0; int order = 0;
@@ -102,13 +102,13 @@ public final class DeployBeanPropertyLists {
if (orderColumn != null) { if (orderColumn != null) {
orderColumn.setDeployOrder(order); orderColumn.setDeployOrder(order);
allocateToList(orderColumn); allocateToList(orderColumn);
propertyMap.put(orderColumn.getName(), orderColumn); propertyMap.put(orderColumn.name(), orderColumn);
} }
if (discProperty != null) { if (discProperty != null) {
// put the discriminator property into the property map only // put the discriminator property into the property map only
// (after the real properties have been organised into their lists) // (after the real properties have been organised into their lists)
propertyMap.put(discProperty.getName(), discProperty); propertyMap.put(discProperty.name(), discProperty);
} }
} }
@@ -198,7 +198,7 @@ final class AnnotationAssocManys extends AnnotationAssoc {
BeanProperty localId = localTable.getIdProperty(); BeanProperty localId = localTable.getIdProperty();
if (localId != null) { if (localId != null) {
// add foreign key based on convention // add foreign key based on convention
String fkColName = namingConvention.getForeignKey(descriptor.getBaseTable(), localId.getName()); String fkColName = namingConvention.getForeignKey(descriptor.getBaseTable(), localId.name());
prop.getTableJoin().addJoinColumn(new DeployTableJoinColumn(localId.getDbColumn(), fkColName)); prop.getTableJoin().addJoinColumn(new DeployTableJoinColumn(localId.getDbColumn(), fkColName));
} }
} }
@@ -43,13 +43,13 @@ public final class ElComparatorProperty<T> implements Comparator<T>, ElComparato
return val2 == null ? 0 : nullOrder; return val2 == null ? 0 : nullOrder;
} }
if (elGetValue.isAssocId()) { if (elGetValue.isAssocId()) {
val1 = elGetValue.getAssocIdValues((EntityBean) val1)[0]; // TODO: compound key not yet supported val1 = elGetValue.assocIdValues((EntityBean) val1)[0]; // TODO: compound key not yet supported
} }
if (val2 == null) { if (val2 == null) {
return -1 * nullOrder; return -1 * nullOrder;
} }
if (elGetValue.isAssocId()) { if (elGetValue.isAssocId()) {
val2 = elGetValue.getAssocIdValues((EntityBean) val2)[0]; val2 = elGetValue.assocIdValues((EntityBean) val2)[0];
} }
Comparable c = (Comparable) val1; Comparable c = (Comparable) val1;
return asc * c.compareTo(val2); return asc * c.compareTo(val2);
@@ -136,12 +136,12 @@ public final class ElPropertyChain implements ElPropertyValue {
} }
@Override @Override
public String getName() { public String name() {
return name; return name;
} }
@Override @Override
public String getElName() { public String elName() {
return expression; return expression;
} }
@@ -171,15 +171,15 @@ public final class ElPropertyChain implements ElPropertyValue {
} }
@Override @Override
public Object[] getAssocIdValues(EntityBean bean) { public Object[] assocIdValues(EntityBean bean) {
// Don't navigate the object graph as bean // Don't navigate the object graph as bean
// is assumed to be the appropriate type // is assumed to be the appropriate type
return lastElPropertyValue.getAssocIdValues(bean); return lastElPropertyValue.assocIdValues(bean);
} }
@Override @Override
public String getAssocIdExpression(String prefix, String operator) { public String assocIdExpression(String prefix, String operator) {
return lastElPropertyValue.getAssocIdExpression(expression, operator); return lastElPropertyValue.assocIdExpression(expression, operator);
} }
@Override @Override
@@ -198,7 +198,7 @@ public final class ElPropertyChain implements ElPropertyValue {
} }
@Override @Override
public Property getProperty() { public Property property() {
return lastBeanProperty; return lastBeanProperty;
} }
@@ -234,7 +234,7 @@ public final class ElPropertyChain implements ElPropertyValue {
} }
@Override @Override
public int getJdbcType() { public int jdbcType() {
return scalarType == null ? 0 : scalarType.getJdbcType(); return scalarType == null ? 0 : scalarType.getJdbcType();
} }
@@ -244,7 +244,7 @@ public final class ElPropertyChain implements ElPropertyValue {
} }
@Override @Override
public StringParser getStringParser() { public StringParser stringParser() {
return scalarType; return scalarType;
} }
@@ -53,12 +53,12 @@ public interface ElPropertyDeploy {
/** /**
* Return the name of the property. * Return the name of the property.
*/ */
String getName(); String name();
/** /**
* The ElPrefix plus name. * The ElPrefix plus name.
*/ */
String getElName(); String elName();
/** /**
* Return the deployment db column for this property. * Return the deployment db column for this property.
@@ -276,7 +276,7 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
if (!beanProperty.isTransient()) { if (!beanProperty.isTransient()) {
Object value = beanProperty.getValue(bean); Object value = beanProperty.getValue(bean);
if (value != null) { if (value != null) {
String propName = SplitName.add(prefix, beanProperty.getName()); String propName = SplitName.add(prefix, beanProperty.name());
if (beanProperty.isScalar()) { if (beanProperty.isScalar()) {
if (value instanceof String) { if (value instanceof String) {
list.add(new LikeExpression(propName, value, caseInsensitive, likeType)); list.add(new LikeExpression(propName, value, caseInsensitive, likeType));
@@ -113,7 +113,7 @@ public final class IdInExpression extends NonPrepareExpression {
request.append(descriptor.getIdBinderInLHSSql()); request.append(descriptor.getIdBinderInLHSSql());
request.append(idBinder.getIdInValueExpr(false, idCollection.size())); request.append(idBinder.getIdInValueExpr(false, idCollection.size()));
} else { } else {
request.append(idBinder.getBeanProperty().getName()); request.append(idBinder.getBeanProperty().name());
request.appendInExpression(false, idCollection); request.appendInExpression(false, idCollection);
} }
} }
@@ -117,7 +117,7 @@ final class InExpression extends AbstractExpression {
List<Object> idList = new ArrayList<>(); List<Object> idList = new ArrayList<>();
for (Object bindValue : bindValues) { for (Object bindValue : bindValues) {
// extract the id values from the bean // extract the id values from the bean
Object[] ids = prop.getAssocIdValues((EntityBean) bindValue); Object[] ids = prop.assocIdValues((EntityBean) bindValue);
if (ids != null) { if (ids != null) {
Collections.addAll(idList, ids); Collections.addAll(idList, ids);
} }
@@ -66,7 +66,7 @@ final class NullExpression extends AbstractExpression {
String nullExpr = notNull ? " is not null" : " is null"; String nullExpr = notNull ? " is not null" : " is null";
if (elProperty != null && elProperty.isAssocId()) { if (elProperty != null && elProperty.isAssocId()) {
request.append(elProperty.getAssocIdExpression(propName, nullExpr)); request.append(elProperty.assocIdExpression(propName, nullExpr));
} else { } else {
request.append(propName).append(nullExpr); request.append(propName).append(nullExpr);
} }
@@ -44,8 +44,8 @@ public final class SimpleExpression extends AbstractValueExpression {
} }
ExpressionPath prop = context.getExpressionPath(propName); ExpressionPath prop = context.getExpressionPath(propName);
if (prop != null && prop.isAssocId()) { if (prop != null && prop.isAssocId()) {
String idName = prop.getAssocIdExpression(propName, ""); String idName = prop.assocIdExpression(propName, "");
Object[] ids = prop.getAssocIdValues((EntityBean) value()); Object[] ids = prop.assocIdValues((EntityBean) value());
if (ids == null || ids.length != 1) { if (ids == null || ids.length != 1) {
throw new IllegalArgumentException("Expecting 1 Id value for " + idName + " but got " + Arrays.toString(ids)); throw new IllegalArgumentException("Expecting 1 Id value for " + idName + " but got " + Arrays.toString(ids));
} }
@@ -73,7 +73,7 @@ public final class SimpleExpression extends AbstractValueExpression {
ElPropertyValue prop = getElProp(request); ElPropertyValue prop = getElProp(request);
if (prop != null) { if (prop != null) {
if (prop.isAssocId()) { if (prop.isAssocId()) {
Object[] ids = prop.getAssocIdValues((EntityBean) value()); Object[] ids = prop.assocIdValues((EntityBean) value());
if (ids != null) { if (ids != null) {
for (Object id : ids) { for (Object id : ids) {
request.addBindValue(id); request.addBindValue(id);
@@ -101,7 +101,7 @@ public final class SimpleExpression extends AbstractValueExpression {
ElPropertyValue prop = getElProp(request); ElPropertyValue prop = getElProp(request);
if (prop != null) { if (prop != null) {
if (prop.isAssocId()) { if (prop.isAssocId()) {
request.append(prop.getAssocIdExpression(propName, type.bind())); request.append(prop.assocIdExpression(propName, type.bind()));
return; return;
} }
if (prop.isDbEncrypted()) { if (prop.isDbEncrypted()) {
@@ -39,7 +39,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
@Override @Override
public void register(BeanPropertyAssocMany<?> many, BeanCollection<?> collection) { public void register(BeanPropertyAssocMany<?> many, BeanCollection<?> collection) {
String path = fullPath + "." + many.getName(); String path = fullPath + "." + many.name();
parent.register(path, many, collection); parent.register(path, many, collection);
} }
@@ -846,7 +846,7 @@ public final class DefaultPersister implements Persister {
Query<?> q = server.createQuery(desc.type()); Query<?> q = server.createQuery(desc.type());
StringBuilder sb = new StringBuilder(30); StringBuilder sb = new StringBuilder(30);
for (BeanPropertyAssocOne<?> aPropImportDelete : propImportDelete) { for (BeanPropertyAssocOne<?> aPropImportDelete : propImportDelete) {
sb.append(aPropImportDelete.getName()).append(","); sb.append(aPropImportDelete.name()).append(",");
} }
q.setAutoTune(false); q.setAutoTune(false);
q.select(sb.toString()); q.select(sb.toString());
@@ -56,7 +56,7 @@ final class DeleteUnloadedForeignKeys {
StringBuilder sb = new StringBuilder(30); StringBuilder sb = new StringBuilder(30);
for (BeanPropertyAssocOne<?> aPropList : propList) { for (BeanPropertyAssocOne<?> aPropList : propList) {
sb.append(aPropList.getName()).append(","); sb.append(aPropList.name()).append(",");
} }
// run query in a separate persistence context // run query in a separate persistence context
@@ -86,7 +86,7 @@ final class MergeHandler {
query.setBeanCacheMode(CacheMode.OFF); query.setBeanCacheMode(CacheMode.OFF);
query.setPersistenceContextScope(PersistenceContextScope.QUERY); query.setPersistenceContextScope(PersistenceContextScope.QUERY);
query.setId(desc.getId(bean)); query.setId(desc.getId(bean));
query.select(desc.idProperty().getName()); query.select(desc.idProperty().name());
for (String path : paths) { for (String path : paths) {
MergeNode node = buildNode(path); MergeNode node = buildNode(path);
@@ -72,7 +72,7 @@ abstract class MergeNode {
*/ */
final void addSelectId(Query<?> query) { final void addSelectId(Query<?> query) {
BeanProperty idProperty = targetDescriptor.idProperty(); BeanProperty idProperty = targetDescriptor.idProperty();
query.fetch(fullPath, idProperty.getName()); query.fetch(fullPath, idProperty.name());
} }
/** /**
@@ -55,6 +55,6 @@ final class MergeNodeAssocOne extends MergeNode {
} }
private EntityBean getEntityBean(Object bean) { private EntityBean getEntityBean(Object bean) {
return (EntityBean) one.getVal(bean); return (EntityBean) one.value(bean);
} }
} }
@@ -72,7 +72,7 @@ abstract class SaveManyBase implements SaveMany {
if (request.isNotifyCache()) { if (request.isNotifyCache()) {
try { try {
String asJson = many.jsonWriteCollection(value); String asJson = many.jsonWriteCollection(value);
request.addCollectionChange(many.getName(), asJson); request.addCollectionChange(many.name(), asJson);
} catch (IOException e) { } catch (IOException e) {
log.error("Error build element collection entry for L2 cache", e); log.error("Error build element collection entry for L2 cache", e);
} }
@@ -64,13 +64,13 @@ final class BindableEncryptedProperty implements Bindable {
if (!bindEncryptDataFirst) { if (!bindEncryptDataFirst) {
// H2 encrypt function ... different parameter order // H2 encrypt function ... different parameter order
request.bindNoLog(encryptKeyValue, Types.VARCHAR, prop.getName() + "=****"); request.bindNoLog(encryptKeyValue, Types.VARCHAR, prop.name() + "=****");
} }
request.bindNoLog(value, prop); request.bindNoLog(value, prop);
if (bindEncryptDataFirst) { if (bindEncryptDataFirst) {
// MySql, Postgres, Oracle // MySql, Postgres, Oracle
request.bindNoLog(encryptKeyValue, Types.VARCHAR, prop.getName() + "=****"); request.bindNoLog(encryptKeyValue, Types.VARCHAR, prop.name() + "=****");
} }
} }
@@ -585,7 +585,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
@Override @Override
public void registerBeanInherit(BeanPropertyAssocOne<?> property, EntityBeanIntercept ebi) { public void registerBeanInherit(BeanPropertyAssocOne<?> property, EntityBeanIntercept ebi) {
String path = getPath(property.getName()); String path = getPath(property.name());
request.loadContext().register(path, ebi, property); request.loadContext().register(path, ebi, property);
} }
@@ -597,7 +597,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
@Override @Override
public void register(BeanPropertyAssocMany<?> many, BeanCollection<?> bc) { public void register(BeanPropertyAssocMany<?> many, BeanCollection<?> bc) {
String path = getPath(many.getName()); String path = getPath(many.name());
request.loadContext().register(path, many, bc); request.loadContext().register(path, many, bc);
} }
@@ -479,7 +479,7 @@ final class CQueryBuilder {
// check if @Id property included in RawSql // check if @Id property included in RawSql
boolean rawNoId = true; boolean rawNoId = true;
BeanProperty idProperty = descriptor.idProperty(); BeanProperty idProperty = descriptor.idProperty();
if (idProperty != null && columnMapping.contains(idProperty.getName())) { if (idProperty != null && columnMapping.contains(idProperty.name())) {
// contains the @Id property for the root level bean // contains the @Id property for the root level bean
rawNoId = false; rawNoId = false;
} }
@@ -63,7 +63,7 @@ final class CQueryOrderBy {
if (beanProperty instanceof BeanPropertyAssoc<?>) { if (beanProperty instanceof BeanPropertyAssoc<?>) {
BeanPropertyAssoc<?> ap = (BeanPropertyAssoc<?>) beanProperty; BeanPropertyAssoc<?> ap = (BeanPropertyAssoc<?>) beanProperty;
IdBinder idBinder = ap.getTargetDescriptor().getIdBinder(); IdBinder idBinder = ap.getTargetDescriptor().getIdBinder();
return idBinder.getOrderBy(el.getElName(), p.isAscending()); return idBinder.getOrderBy(el.elName(), p.isAscending());
} }
return p.toStringFormat(); return p.toStringFormat();
@@ -212,7 +212,7 @@ public final class CQueryPredicates {
BeanPropertyAssocMany<?> manyProperty = request.determineMany(); BeanPropertyAssocMany<?> manyProperty = request.determineMany();
if (manyProperty != null) { if (manyProperty != null) {
OrmQueryProperties chunk = query.getDetail().getChunk(manyProperty.getName(), false); OrmQueryProperties chunk = query.getDetail().getChunk(manyProperty.name(), false);
SpiExpressionList<?> filterManyExpr = chunk.getFilterMany(); SpiExpressionList<?> filterManyExpr = chunk.getFilterMany();
if (filterManyExpr != null) { if (filterManyExpr != null) {
this.filterMany = new DefaultExpressionRequest(request, deployParser, binder, filterManyExpr); this.filterMany = new DefaultExpressionRequest(request, deployParser, binder, filterManyExpr);
@@ -337,7 +337,7 @@ public final class CQueryPredicates {
// check for default ordering on the many property... // check for default ordering on the many property...
String manyOrderBy = manyProp.getFetchOrderBy(); String manyOrderBy = manyProp.getFetchOrderBy();
if (manyOrderBy != null) { if (manyOrderBy != null) {
orderBy = orderBy + ", " + CQueryBuilder.prefixOrderByFields(manyProp.getName(), manyOrderBy); orderBy = orderBy + ", " + CQueryBuilder.prefixOrderByFields(manyProp.name(), manyOrderBy);
} }
if (request.isFindById()) { if (request.isFindById()) {
@@ -353,7 +353,7 @@ public final class CQueryPredicates {
// we need to make sure their is an order by on the // we need to make sure their is an order by on the
// top level first (to ensure master/detail construction). // top level first (to ensure master/detail construction).
int manyPos = orderBy.indexOf(manyProp.getName()); int manyPos = orderBy.indexOf(manyProp.name());
int idPos = orderBy.indexOf(" " + orderById); int idPos = orderBy.indexOf(" " + orderById);
if (manyPos == -1) { if (manyPos == -1) {
@@ -370,9 +370,9 @@ public final class CQueryPredicates {
if (idPos <= -1 || idPos >= manyPos) { if (idPos <= -1 || idPos >= manyPos) {
if (idPos > manyPos) { if (idPos > manyPos) {
// there was an error with the order by... // there was an error with the order by...
String msg = "A Query on [" + desc + "] includes a join to a 'many' association [" + manyProp.getName(); String msg = "A Query on [" + desc + "] includes a join to a 'many' association [" + manyProp.name();
msg += "] with an incorrect orderBy [" + orderBy + "]. The id property [" + orderById + "]"; msg += "] with an incorrect orderBy [" + orderBy + "]. The id property [" + orderById + "]";
msg += " must come before the many property [" + manyProp.getName() + "] in the orderBy."; msg += " must come before the many property [" + manyProp.name() + "] in the orderBy.";
msg += " Ebean has automatically modified the orderBy clause to do this."; msg += " Ebean has automatically modified the orderBy clause to do this.";
logger.warn(msg); logger.warn(msg);
@@ -17,7 +17,7 @@ public interface STreeProperty extends ScalarDataReader<Object> {
/** /**
* Return the property name. * Return the property name.
*/ */
String getName(); String name();
/** /**
* Return the full property name (for error messages). * Return the full property name (for error messages).
@@ -226,7 +226,7 @@ public final class SqlTreeBuilder {
List<SqlTreeNode> myJoinList = new ArrayList<>(); List<SqlTreeNode> myJoinList = new ArrayList<>();
List<STreePropertyAssocOne> extraProps = new ArrayList<>(); List<STreePropertyAssocOne> extraProps = new ArrayList<>();
for (STreePropertyAssocOne one : desc.propsOne()) { for (STreePropertyAssocOne one : desc.propsOne()) {
String propPrefix = SplitName.add(prefix, one.getName()); String propPrefix = SplitName.add(prefix, one.name());
if (isIncludeBean(propPrefix)) { if (isIncludeBean(propPrefix)) {
selectIncludes.add(propPrefix); selectIncludes.add(propPrefix);
if (!one.hasForeignKey()) { if (!one.hasForeignKey()) {
@@ -237,7 +237,7 @@ public final class SqlTreeBuilder {
} }
for (STreePropertyAssocMany many : desc.propsMany()) { for (STreePropertyAssocMany many : desc.propsMany()) {
String propPrefix = SplitName.add(prefix, many.getName()); String propPrefix = SplitName.add(prefix, many.name());
if (isIncludeMany(propPrefix, many)) { if (isIncludeMany(propPrefix, many)) {
selectIncludes.add(propPrefix); selectIncludes.add(propPrefix);
buildSelectChain(propPrefix, many, many.target(), myJoinList); buildSelectChain(propPrefix, many, many.target(), myJoinList);
@@ -413,7 +413,7 @@ public final class SqlTreeBuilder {
} else { } else {
logger.error("property [" + propName + "] not found on " + desc + " for query - excluding it."); logger.error("property [" + propName + "] not found on " + desc + " for query - excluding it.");
} }
} else if (p.isEmbedded() || (p instanceof STreePropertyAssoc && !queryProps.isIncludedBeanJoin(p.getName()))) { } else if (p.isEmbedded() || (p instanceof STreePropertyAssoc && !queryProps.isIncludedBeanJoin(p.name()))) {
// add the embedded bean or the *ToOne assoc bean. We skip the check that the *ToOne propName maps to Id property ... // add the embedded bean or the *ToOne assoc bean. We skip the check that the *ToOne propName maps to Id property ...
selectProps.add(p); selectProps.add(p);
} else { } else {
@@ -440,7 +440,7 @@ public final class SqlTreeBuilder {
// included as a bean join. With a bean join // included as a bean join. With a bean join
// the property should be excluded as the bean // the property should be excluded as the bean
// join has its own node in the SqlTree. // join has its own node in the SqlTree.
if (!queryProps.isIncludedBeanJoin(p.getName())) { if (!queryProps.isIncludedBeanJoin(p.name())) {
// include the property... which basically // include the property... which basically
// means include the foreign key column(s) // means include the foreign key column(s)
selectProps.add(p); selectProps.add(p);
@@ -497,7 +497,7 @@ public final class SqlTreeBuilder {
for (STreePropertyAssocOne propertyAssocOne : desc.propsOne()) { for (STreePropertyAssocOne propertyAssocOne : desc.propsOne()) {
//noinspection StatementWithEmptyBody //noinspection StatementWithEmptyBody
if (queryProps != null if (queryProps != null
&& queryProps.isIncludedBeanJoin(propertyAssocOne.getName()) && queryProps.isIncludedBeanJoin(propertyAssocOne.name())
&& propertyAssocOne.hasForeignKey() && propertyAssocOne.hasForeignKey()
&& !propertyAssocOne.isFormula()) { && !propertyAssocOne.isFormula()) {
// if it is a joined bean with FK constraint... then don't add the property // if it is a joined bean with FK constraint... then don't add the property
@@ -139,7 +139,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
private Map<String, String> createPathMap(String prefix, STreeType desc) { private Map<String, String> createPathMap(String prefix, STreeType desc) {
HashMap<String, String> m = new HashMap<>(); HashMap<String, String> m = new HashMap<>();
for (STreePropertyAssocMany many : desc.propsMany()) { for (STreePropertyAssocMany many : desc.propsMany()) {
String name = many.getName(); String name = many.name();
m.put(name, getPath(prefix, name)); m.put(name, getPath(prefix, name));
} }
return m; return m;
@@ -35,7 +35,7 @@ public final class SqlTreeProperties {
public void add(STreeProperty prop) { public void add(STreeProperty prop) {
propsList.add(prop); propsList.add(prop);
propNames.add(prop.getName()); propNames.add(prop.name());
if (prop.isAggregation()) { if (prop.isAggregation()) {
if (!aggregation) { if (!aggregation) {
aggregation = true; aggregation = true;
@@ -129,7 +129,7 @@ public class TCsvReader<T> implements CsvReader<T> {
throw new TextException("Property " + propertyName + " is not DateTime capable"); throw new TextException("Property " + propertyName + " is not DateTime capable");
} }
if (dateTimeFormat == null) { if (dateTimeFormat == null) {
dateTimeFormat = getDefaultDateTimeFormat(elProp.getJdbcType()); dateTimeFormat = getDefaultDateTimeFormat(elProp.jdbcType());
} }
if (locale == null) { if (locale == null) {
@@ -162,7 +162,7 @@ public class TCsvReader<T> implements CsvReader<T> {
ExpressionPath elProp = descriptor.expressionPath(propertyName); ExpressionPath elProp = descriptor.expressionPath(propertyName);
if (parser == null) { if (parser == null) {
parser = elProp.getStringParser(); parser = elProp.stringParser();
} }
CsvColumn column = new CsvColumn(elProp, parser); CsvColumn column = new CsvColumn(elProp, parser);
columnList.add(column); columnList.add(column);
@@ -240,10 +240,10 @@ public class TCsvReader<T> implements CsvReader<T> {
throw new TextException("Property [" + aLine + "] not found"); throw new TextException("Property [" + aLine + "] not found");
} }
if (Types.TIME == elProp.getJdbcType()) { if (Types.TIME == elProp.jdbcType()) {
addProperty(aLine, TIME_PARSER); addProperty(aLine, TIME_PARSER);
} else if (isDateTimeType(elProp.getJdbcType())) { } else if (isDateTimeType(elProp.jdbcType())) {
addDateTime(aLine, null, null); addDateTime(aLine, null, null);
} else if (elProp.isAssocProperty()) { } else if (elProp.isAssocProperty()) {
@@ -506,7 +506,7 @@ public final class WriteJson implements SpiJsonWriter {
return true; return true;
if (currentIncludeProps != null) { if (currentIncludeProps != null) {
// explicitly controlled by pathProperties // explicitly controlled by pathProperties
return currentIncludeProps.contains(prop.getName()); return currentIncludeProps.contains(prop.name());
} else { } else {
// include only loaded properties // include only loaded properties
return currentBean._ebean_getIntercept().isLoadedProperty(prop.getPropertyIndex()); return currentBean._ebean_getIntercept().isLoadedProperty(prop.getPropertyIndex());
@@ -518,7 +518,7 @@ public final class WriteJson implements SpiJsonWriter {
return false; return false;
} else if (!explicitAllProps && currentIncludeProps != null) { } else if (!explicitAllProps && currentIncludeProps != null) {
// explicitly controlled by pathProperties // explicitly controlled by pathProperties
return currentIncludeProps.contains(prop.getName()); return currentIncludeProps.contains(prop.name());
} else { } else {
// by default include transient properties // by default include transient properties
return true; return true;
@@ -178,7 +178,7 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
BeanProperty idProperty = targetDesc.idProperty(); BeanProperty idProperty = targetDesc.idProperty();
if (idProperty != null) { if (idProperty != null) {
// embedded beans don't have id property // embedded beans don't have id property
String fullPath = path + "." + idProperty.getName(); String fullPath = path + "." + idProperty.name();
targetDesc.docStoreAdapter().registerInvalidationPath(desc.docStoreQueueId(), fullPath, pathProp.getProperties()); targetDesc.docStoreAdapter().registerInvalidationPath(desc.docStoreQueueId(), fullPath, pathProp.getProperties());
} }
} }
@@ -87,7 +87,7 @@ public class DocStructure {
BeanDescriptor<?> targetDesc = embProp.getTargetDescriptor(); BeanDescriptor<?> targetDesc = embProp.getTargetDescriptor();
PathProperties manyRootPath = new PathProperties(); PathProperties manyRootPath = new PathProperties();
manyRootPath.addToPath(null, targetDesc.idProperty().getName()); manyRootPath.addToPath(null, targetDesc.idProperty().name());
manyRootPath.addNested(prop, embedded.get(prop)); manyRootPath.addNested(prop, embedded.get(prop));
manyRoot.put(prop, manyRootPath); manyRoot.put(prop, manyRootPath);
@@ -72,7 +72,7 @@ public class BeanTypeTest {
order.setStatus(Order.Status.APPROVED); order.setStatus(Order.Status.APPROVED);
Property statusProperty = beanType(Order.class).property("status"); Property statusProperty = beanType(Order.class).property("status");
assertThat(statusProperty.getVal(order)).isEqualTo(order.getStatus()); assertThat(statusProperty.value(order)).isEqualTo(order.getStatus());
} }
@Test @Test
@@ -28,10 +28,10 @@ public class PropertyTest {
order.setStatus(Order.Status.APPROVED); order.setStatus(Order.Status.APPROVED);
Property statusProperty = beanType(Order.class).property("status"); Property statusProperty = beanType(Order.class).property("status");
assertThat(statusProperty.getVal(order)).isEqualTo(order.getStatus()); assertThat(statusProperty.value(order)).isEqualTo(order.getStatus());
Property customerProperty = beanType(Order.class).property("customer"); Property customerProperty = beanType(Order.class).property("customer");
assertThat(customerProperty.getVal(order)).isEqualTo(customer); assertThat(customerProperty.value(order)).isEqualTo(customer);
} }
@Test @Test
@@ -49,8 +49,8 @@ public class PropertyTest {
@Test @Test
public void name() { public void name() {
assertThat(beanType(Order.class).property("status").getName()).isEqualTo("status"); assertThat(beanType(Order.class).property("status").name()).isEqualTo("status");
assertThat(beanType(Order.class).property("customer").getName()).isEqualTo("customer"); assertThat(beanType(Order.class).property("customer").name()).isEqualTo("customer");
assertThat(beanType(Order.class).property("details").getName()).isEqualTo("details"); assertThat(beanType(Order.class).property("details").name()).isEqualTo("details");
} }
} }
@@ -33,10 +33,10 @@ public class TestBeanDescriptorHasIdProperty extends BaseTestCase {
BeanDescriptor<Order> beanDescriptor = spiServer.getBeanDescriptor(Order.class); BeanDescriptor<Order> beanDescriptor = spiServer.getBeanDescriptor(Order.class);
assertNotNull(beanDescriptor.idProperty()); assertNotNull(beanDescriptor.idProperty());
assertEquals("id", beanDescriptor.idProperty().getName()); assertEquals("id", beanDescriptor.idProperty().name());
assertNotNull(beanDescriptor.getVersionProperty()); assertNotNull(beanDescriptor.getVersionProperty());
assertEquals("updtime", beanDescriptor.getVersionProperty().getName()); assertEquals("updtime", beanDescriptor.getVersionProperty().name());
Order order = new Order(); Order order = new Order();
@@ -32,14 +32,14 @@ public class TestELBasic extends BaseTestCase {
ElPropertyDeploy elBillAddressId = descriptor.getElPropertyDeploy("billingAddress.id"); ElPropertyDeploy elBillAddressId = descriptor.getElPropertyDeploy("billingAddress.id");
assertTrue(elBillAddressId instanceof BeanFkeyProperty); assertTrue(elBillAddressId instanceof BeanFkeyProperty);
assertEquals("billing_address_id", elBillAddressId.getDbColumn()); assertEquals("billing_address_id", elBillAddressId.getDbColumn());
assertEquals("billingAddress.id", elBillAddressId.getName()); assertEquals("billingAddress.id", elBillAddressId.name());
assertNull(elBillAddressId.getElPrefix()); assertNull(elBillAddressId.getElPrefix());
ElPropertyDeploy elBillAddressCity = descriptor.getElPropertyDeploy("billingAddress.city"); ElPropertyDeploy elBillAddressCity = descriptor.getElPropertyDeploy("billingAddress.city");
assertTrue(elBillAddressCity instanceof ElPropertyChain); assertTrue(elBillAddressCity instanceof ElPropertyChain);
assertEquals("billingAddress", elBillAddressCity.getElPrefix()); assertEquals("billingAddress", elBillAddressCity.getElPrefix());
assertEquals("city", elBillAddressCity.getName()); assertEquals("city", elBillAddressCity.name());
assertEquals("${billingAddress}city", elBillAddressCity.getElPlaceholder(false)); assertEquals("${billingAddress}city", elBillAddressCity.getElPlaceholder(false));
assertEquals("city", elBillAddressCity.getDbColumn()); assertEquals("city", elBillAddressCity.getDbColumn());
@@ -52,7 +52,7 @@ public class TestELBasic extends BaseTestCase {
ElPropertyDeploy elOrderStatus = descriptor.getElPropertyDeploy("orders.status"); ElPropertyDeploy elOrderStatus = descriptor.getElPropertyDeploy("orders.status");
assertTrue(elOrderStatus instanceof ElPropertyChain); assertTrue(elOrderStatus instanceof ElPropertyChain);
assertEquals("orders", elOrderStatus.getElPrefix()); assertEquals("orders", elOrderStatus.getElPrefix());
assertEquals("status", elOrderStatus.getName()); assertEquals("status", elOrderStatus.name());
assertEquals("${orders}status", elOrderStatus.getElPlaceholder(false)); assertEquals("${orders}status", elOrderStatus.getElPlaceholder(false));
assertEquals("status", elOrderStatus.getDbColumn()); assertEquals("status", elOrderStatus.getDbColumn());
@@ -95,8 +95,8 @@ public class TestInsertCheckUnique extends BaseTestCase {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
properties.forEach((it)-> { properties.forEach((it)-> {
Object propertyValue = it.getVal(doc2); Object propertyValue = it.value(doc2);
String propertyName = it.getName(); String propertyName = it.name();
msg.append(" property["+propertyName+"] value["+propertyValue+"]"); msg.append(" property["+propertyName+"] value["+propertyValue+"]");
}); });
@@ -30,7 +30,7 @@ public class TestEmbeddedManyToOne extends BaseTestCase {
EPerAddr perAddr = new EPerAddr("Embed", addr); EPerAddr perAddr = new EPerAddr("Embed", addr);
Property country = embType.property("country"); Property country = embType.property("country");
Object val = country.getVal(addr); Object val = country.value(addr);
assertThat(val).isSameAs(nz); assertThat(val).isSameAs(nz);
@@ -199,9 +199,9 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
MCompoundForeignKey compoundKey = null; MCompoundForeignKey compoundKey = null;
if (columns.length > 1) { if (columns.length > 1) {
// compound foreign key // compound foreign key
String refTable = p.getTargetDescriptor().getBaseTable(); String refTable = p.getTargetDescriptor().baseTable();
String fkName = foreignKeyConstraintName(p.getName()); String fkName = foreignKeyConstraintName(p.name());
String fkIndex = foreignKeyIndexName(p.getName()); String fkIndex = foreignKeyIndexName(p.name());
compoundKey = new MCompoundForeignKey(fkName, refTable, fkIndex); compoundKey = new MCompoundForeignKey(fkName, refTable, fkIndex);
table.addForeignKey(compoundKey); table.addForeignKey(compoundKey);
} }
@@ -253,7 +253,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
} else { } else {
String[] cols = indexSetAdd(toColumnNames(modelColumns)); String[] cols = indexSetAdd(toColumnNames(modelColumns));
String uqName = uniqueConstraintName(p.getName()); String uqName = uniqueConstraintName(p.name());
table.addUniqueConstraint(new MCompoundUniqueConstraint(cols, uqName)); table.addUniqueConstraint(new MCompoundUniqueConstraint(cols, uqName));
} }
} }
@@ -307,7 +307,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
if (checkConstraintValues != null) { if (checkConstraintValues != null) {
if (beanDescriptor.hasInheritance()) { if (beanDescriptor.hasInheritance()) {
InheritInfo inheritInfo = beanDescriptor.getInheritInfo(); InheritInfo inheritInfo = beanDescriptor.getInheritInfo();
inheritInfo.appendCheckConstraintValues(p.getName(), checkConstraintValues); inheritInfo.appendCheckConstraintValues(p.name(), checkConstraintValues);
} }
col.setCheckConstraint(buildCheckConstraint(p.getDbColumn(), checkConstraintValues)); col.setCheckConstraint(buildCheckConstraint(p.getDbColumn(), checkConstraintValues));
col.setCheckConstraintName(checkConstraintName(col.getName())); col.setCheckConstraintName(checkConstraintName(col.getName()));