#1747 - Refactor tidy tighten access on ebeaninternal/server/deploy

Adds PropertyAssocMany to ensure public access on BeanPropertyAssocMany helper methods for ebean-elastic integration.
This commit is contained in:
rob bygrave committed 2019-07-02 20:46:49 +12:00
1 parent 140178bb47
commit 5f2454831e
40 files changed
+275 -268

No files matched your search

@@ -13,9 +13,9 @@ import java.sql.SQLException;
*/
abstract class AssocOneHelp {
protected final BeanPropertyAssocOne<?> property;
final BeanPropertyAssocOne<?> property;
protected final BeanDescriptor<?> target;
private final BeanDescriptor<?> target;
private final String path;
@@ -11,7 +11,7 @@ import java.util.Collection;
abstract class BaseCollectionHelp<T> implements BeanCollectionHelp<T> {
final BeanPropertyAssocMany<T> many;
final BeanDescriptor<T> targetDescriptor;
private final BeanDescriptor<T> targetDescriptor;
final String propertyName;
BeanCollectionLoader loader;
@@ -290,14 +290,14 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Inheritance information. Server side only.
*/
protected final InheritInfo inheritInfo;
final InheritInfo inheritInfo;
private final boolean abstractType;
/**
* Derived list of properties that make up the unique id.
*/
protected final BeanProperty idProperty;
private final BeanProperty idProperty;
private final int idPropertyIndex;
@@ -609,7 +609,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Create an entity bean that is used as a prototype/factory to create new instances.
*/
protected EntityBean createPrototypeEntityBean(Class<T> beanType) {
EntityBean createPrototypeEntityBean(Class<T> beanType) {
if (Modifier.isAbstract(beanType.getModifiers())) {
return null;
}
@@ -667,7 +667,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return entityType;
}
public String[] getProperties() {
private String[] getProperties() {
return properties;
}
@@ -1508,7 +1508,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Invalidate parts of cache due to SqlUpdate or external modification etc.
*/
public void cachePersistTableIUD(TableIUD tableIUD, CacheChangeSet changeSet) {
void cachePersistTableIUD(TableIUD tableIUD, CacheChangeSet changeSet) {
cacheHelp.persistTableIUD(tableIUD, changeSet);
}
@@ -1626,7 +1626,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return new DeployUpdateParser(this).parse(ormUpdateStatement);
}
public void collectQueryPlans(QueryPlanRequest request) {
void collectQueryPlans(QueryPlanRequest request) {
for (CQueryPlan queryPlan : queryPlanCache.values()) {
if (request.includeLabel(queryPlan.getLabel())) {
queryPlan.collectQueryPlan(request);
@@ -1657,7 +1657,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Trim query plans not used since the passed in epoch time.
*/
public List<CQueryPlan> trimQueryPlans(long unusedSince) {
List<CQueryPlan> trimQueryPlans(long unusedSince) {
List<CQueryPlan> list = new ArrayList<>();
@@ -1723,7 +1723,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
* Return true if save does not recurse to other beans. That is return true if
* there are no assoc one or assoc many beans that cascade save.
*/
public boolean isSaveRecurseSkippable() {
boolean isSaveRecurseSkippable() {
return saveRecurseSkippable;
}
@@ -1731,7 +1731,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
* Return true if delete does not recurse to other beans. That is return true
* if there are no assoc one or assoc many beans that cascade delete.
*/
public boolean isDeleteRecurseSkippable() {
boolean isDeleteRecurseSkippable() {
return deleteRecurseSkippable;
}
@@ -1813,7 +1813,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Return a raw expression for 'where parent id in ...' clause.
*/
public String getParentIdInExpr(int parentIdSize, String rawWhere) {
String getParentIdInExpr(int parentIdSize, String rawWhere) {
String inClause = idBinder.getIdInValueExpr(false, parentIdSize);
return idBinder.isIdInExpandedForm() ? inClause : rawWhere + inClause;
}
@@ -1829,7 +1829,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Return true if this bean type has a simple single Id property.
*/
public boolean isSimpleId() {
boolean isSimpleId() {
return idBinder instanceof IdBinderSimple;
}
@@ -1897,7 +1897,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
* a reference (then {@link BeanPostLoad#postLoad(Object)} will be invoked
* on first access (lazy load) or immediately (eager load)
*/
public EntityBean createEntityBean(boolean isNew) {
private EntityBean createEntityBean(boolean isNew) {
if (prototypeEntityBean == null) {
throw new UnsupportedOperationException("cannot create entity bean for abstract entity " + getName());
}
@@ -2248,7 +2248,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
/**
* Return the cache key for the given bean (based on id value).
*/
public String cacheKeyForBean(EntityBean bean) {
String cacheKeyForBean(EntityBean bean) {
return cacheKey(idProperty.getValue(bean));
}
@@ -2285,7 +2285,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
* The usage is to provide simple id types for JSON processing (for embeddedId's).
* </p>
*/
public Object convertIdFromJson(Object idValue) {
Object convertIdFromJson(Object idValue) {
return idBinder.convertIdFromJson(idValue);
}
@@ -2510,7 +2510,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return elProp;
}
protected ElPropertyValue buildElGetValue(String propName, ElPropertyChainBuilder chain, boolean propertyDeploy) {
ElPropertyValue buildElGetValue(String propName, ElPropertyChainBuilder chain, boolean propertyDeploy) {
if (propertyDeploy && chain != null) {
ElPropertyDeploy fk = elDeployCache.get(propName);
@@ -2928,7 +2928,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
softDeleteProperty.setSoftDeleteValue(bean);
}
public String getSoftDeleteDbSet() {
String getSoftDeleteDbSet() {
return softDeleteProperty.getSoftDeleteDbSet();
}
@@ -2950,7 +2950,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
}
}
/**
* Return true if this entity type is draftable.
*/
@@ -3000,7 +2999,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
}
}
public void setUnmappedJson(EntityBean bean, Map<String, Object> unmappedProperties) {
void setUnmappedJson(EntityBean bean, Map<String, Object> unmappedProperties) {
if (unmappedJson != null) {
unmappedJson.setValueIntercept(bean, unmappedProperties);
}
@@ -3229,7 +3228,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return ebi.isReference() || hasIdPropertyOnly(ebi);
}
public boolean hasIdPropertyOnly(EntityBeanIntercept ebi) {
boolean hasIdPropertyOnly(EntityBeanIntercept ebi) {
return ebi.hasIdOnly(idPropertyIndex);
}
@@ -3237,11 +3236,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return ebi.isLoadedProperty(idPropertyIndex);
}
public boolean hasIdValue(EntityBean bean) {
boolean hasIdValue(EntityBean bean) {
return (idProperty != null && !DmlUtil.isNullOrZero(idProperty.getValue(bean)));
}
public boolean hasVersionProperty(EntityBeanIntercept ebi) {
boolean hasVersionProperty(EntityBeanIntercept ebi) {
return versionPropertyIndex > -1 && ebi.isLoadedProperty(versionPropertyIndex);
}
@@ -3490,7 +3489,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
jsonHelp.jsonWriteDirty(writeJson, bean, dirtyProps);
}
protected void jsonWriteDirtyProperties(SpiJsonWriter writeJson, EntityBean bean, boolean[] dirtyProps) throws IOException {
void jsonWriteDirtyProperties(SpiJsonWriter writeJson, EntityBean bean, boolean[] dirtyProps) throws IOException {
jsonHelp.jsonWriteDirtyProperties(writeJson, bean, dirtyProps);
}
@@ -3514,7 +3513,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
jsonHelp.jsonWrite(writeJson, bean, key);
}
protected void jsonWriteProperties(SpiJsonWriter writeJson, EntityBean bean) throws IOException {
void jsonWriteProperties(SpiJsonWriter writeJson, EntityBean bean) throws IOException {
jsonHelp.jsonWriteProperties(writeJson, bean);
}
@@ -3522,7 +3521,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return jsonHelp.jsonRead(jsonRead, path, true);
}
public T jsonReadObject(SpiJsonReader jsonRead, String path) throws IOException {
T jsonReadObject(SpiJsonReader jsonRead, String path) throws IOException {
return jsonHelp.jsonRead(jsonRead, path, false);
}
@@ -3553,5 +3552,4 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
getInheritInfo().visitChildren(info -> visitor.accept(info.desc()));
}
}
}
@@ -11,7 +11,7 @@ import java.util.List;
*
* @param <T> The entity bean type
*/
public final class BeanDescriptorDraftHelp<T> {
final class BeanDescriptorDraftHelp<T> {
private final BeanDescriptor<T> desc;
@@ -19,7 +19,7 @@ public final class BeanDescriptorDraftHelp<T> {
private final BeanProperty[] resetProperties;
public BeanDescriptorDraftHelp(BeanDescriptor<T> desc) {
BeanDescriptorDraftHelp(BeanDescriptor<T> desc) {
this.desc = desc;
this.draftDirty = desc.getDraftDirty();
this.resetProperties = resetProperties();
@@ -45,7 +45,7 @@ public final class BeanDescriptorDraftHelp<T> {
/**
* Set the value of all the 'reset properties' to null on the draft bean.
*/
public boolean draftReset(T draftBean) {
boolean draftReset(T draftBean) {
EntityBean draftEntityBean = (EntityBean) draftBean;
@@ -102,7 +102,7 @@ public final class BeanDescriptorDraftHelp<T> {
/**
* Fetch draftable element relationships.
*/
public void draftQueryOptimise(Query<T> query) {
void draftQueryOptimise(Query<T> query) {
BeanPropertyAssocOne<?>[] one = desc.propertiesOne();
for (BeanPropertyAssocOne<?> anOne : one) {
@@ -663,7 +663,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
return (BeanManager<T>) getBeanManager(entityType.getName());
}
public BeanManager<?> getBeanManager(String beanClassName) {
private BeanManager<?> getBeanManager(String beanClassName) {
return beanManagerMap.get(beanClassName);
}
@@ -3,9 +3,9 @@ package io.ebeaninternal.server.deploy;
public class BeanEmbeddedMeta {
final BeanProperty[] properties;
private final BeanProperty[] properties;
public BeanEmbeddedMeta(BeanProperty[] properties) {
BeanEmbeddedMeta(BeanProperty[] properties) {
this.properties = properties;
}
@@ -9,7 +9,7 @@ import java.util.Map;
* Creates BeanProperties for Embedded beans that have deployment information
* such as the actual DB column name and table alias.
*/
public class BeanEmbeddedMetaFactory {
class BeanEmbeddedMetaFactory {
/**
* Create BeanProperties for embedded beans using the deployment specific DB column name and table alias.
@@ -11,25 +11,24 @@ import java.util.List;
/**
* Default implementation for BeanFinderFactory.
*/
public class BeanFinderManager {
class BeanFinderManager {
final Logger logger = LoggerFactory.getLogger(BeanFinderManager.class);
private final Logger logger = LoggerFactory.getLogger(BeanFinderManager.class);
private final List<BeanFindController> list;
public BeanFinderManager(BootupClasses bootupClasses) {
BeanFinderManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanFindControllers();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Return the BeanPersistController for a given entity type.
*/
public void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
for (BeanFindController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
@@ -141,11 +141,11 @@ class BeanLifecycleAdapterFactory {
/**
* Utility method to covert List of Method into array (because we care about performance here).
*/
static Method[] toArray(List<Method> methodList) {
private static Method[] toArray(List<Method> methodList) {
return methodList.toArray(new Method[0]);
}
static RuntimeException unwrapException(ReflectiveOperationException e) {
private static RuntimeException unwrapException(ReflectiveOperationException e) {
if (e instanceof InvocationTargetException) {
Throwable targetException = ((InvocationTargetException)e).getTargetException();
if (targetException instanceof RuntimeException) {
@@ -7,16 +7,15 @@ import io.ebeaninternal.server.persist.dml.DmlBeanPersisterFactory;
/**
* Creates BeanManagers.
*/
public class BeanManagerFactory {
class BeanManagerFactory {
final BeanPersisterFactory persisterFactory;
private final BeanPersisterFactory persisterFactory;
public BeanManagerFactory(DatabasePlatform dbPlatform) {
BeanManagerFactory(DatabasePlatform dbPlatform) {
persisterFactory = new DmlBeanPersisterFactory(dbPlatform);
}
public <T> BeanManager<T> create(BeanDescriptor<T> desc) {
return new BeanManager<>(desc, persisterFactory.create(desc));
}
@@ -43,6 +43,7 @@ import io.ebeanservice.docstore.api.support.DocStructure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.persistence.PersistenceException;
import java.io.DataInput;
import java.io.DataOutput;
@@ -65,19 +66,19 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Flag to mark this is the id property.
*/
final boolean id;
private final boolean id;
final boolean importedPrimaryKey;
private final boolean importedPrimaryKey;
/**
* Flag to make this as a dummy property for unidirecitonal relationships.
*/
final boolean unidirectionalShadow;
private final boolean unidirectionalShadow;
/**
* Flag set if this maps to the inheritance discriminator column
*/
final boolean discriminator;
private final boolean discriminator;
/**
* Flag to mark the property as embedded. This could be on
@@ -89,55 +90,55 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Flag indicating if this the version property.
*/
final boolean version;
private final boolean version;
final boolean naturalKey;
private final boolean naturalKey;
/**
* Set if this property is nullable.
*/
final boolean nullable;
private final boolean nullable;
final boolean unique;
private final boolean unique;
/**
* Is this property include in database resultSet.
*/
final boolean dbRead;
private final boolean dbRead;
/**
* Include in DB insert.
*/
final boolean dbInsertable;
private final boolean dbInsertable;
/**
* Include in DB update.
*/
final boolean dbUpdatable;
private final boolean dbUpdatable;
/**
* True if the property is based on a SECONDARY table.
*/
final boolean secondaryTable;
private final boolean secondaryTable;
final TableJoin secondaryTableJoin;
final String secondaryTableJoinPrefix;
private final TableJoin secondaryTableJoin;
private final String secondaryTableJoinPrefix;
/**
* The property is inherited from a super class.
*/
final boolean inherited;
private final boolean inherited;
final Class<?> owningType;
private final Class<?> owningType;
final boolean local;
private final boolean local;
/**
* True if the property is a Clob, Blob LongVarchar or LongVarbinary.
*/
final boolean lob;
private final boolean lob;
final boolean fetchEager;
private final boolean fetchEager;
final boolean isTransient;
@@ -151,62 +152,62 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* The reflected field.
*/
final Field field;
private final Field field;
/**
* The bean type.
*/
final Class<?> propertyType;
private final Class<?> propertyType;
final String dbBind;
private final String dbBind;
/**
* The database column. This can include quoted identifiers.
*/
final String dbColumn;
final String elPrefix;
private final String elPrefix;
final String elPlaceHolder;
final String elPlaceHolderEncrypted;
/**
* Select part of a SQL Formula used to populate this property.
*/
final String sqlFormulaSelect;
private final String sqlFormulaSelect;
/**
* Join part of a SQL Formula.
*/
final String sqlFormulaJoin;
final String aggregation;
private final String aggregation;
final boolean formula;
private final boolean formula;
/**
* Set to true if stored encrypted.
*/
final boolean dbEncrypted;
private final boolean dbEncrypted;
final boolean localEncrypted;
private final boolean localEncrypted;
final int dbEncryptedType;
private final int dbEncryptedType;
/**
* The jdbc data type this maps to.
*/
final int dbType;
private final int dbType;
final boolean excludedFromHistory;
/**
* Generator for insert or update timestamp etc.
*/
final GeneratedProperty generatedProperty;
private final GeneratedProperty generatedProperty;
final BeanPropertyGetter getter;
private final BeanPropertyGetter getter;
final BeanPropertySetter setter;
private final BeanPropertySetter setter;
final BeanDescriptor<?> descriptor;
@@ -217,56 +218,56 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
@SuppressWarnings("rawtypes")
final ScalarType scalarType;
final DocPropertyOptions docOptions;
private final DocPropertyOptions docOptions;
/**
* The length or precision for DB column.
*/
final int dbLength;
private final int dbLength;
/**
* The scale for DB column (decimal).
*/
final int dbScale;
private final int dbScale;
/**
* Deployment defined DB column definition.
*/
final String dbColumnDefn;
private final String dbColumnDefn;
/**
* DB Column default value for DDL definition (FALSE, NOW etc).
*/
final String dbColumnDefault;
final List<DbMigrationInfo> dbMigrationInfos;
private final String dbColumnDefault;
private final List<DbMigrationInfo> dbMigrationInfos;
/**
* Database DDL column comment.
*/
final String dbComment;
private final String dbComment;
final DbEncryptFunction dbEncryptFunction;
private final DbEncryptFunction dbEncryptFunction;
int deployOrder;
private int deployOrder;
final boolean jsonSerialize;
final boolean jsonDeserialize;
final boolean unmappedJson;
final boolean tenantId;
private final boolean unmappedJson;
private final boolean tenantId;
final boolean draft;
private final boolean draft;
final boolean draftOnly;
private final boolean draftOnly;
final boolean draftDirty;
private final boolean draftDirty;
final boolean draftReset;
private final boolean draftReset;
final boolean softDelete;
private final boolean softDelete;
final String softDeleteDbSet;
private final String softDeleteDbSet;
final String softDeleteDbPredicate;
private final String softDeleteDbPredicate;
public BeanProperty(DeployBeanProperty deploy) {
this(null, deploy);
@@ -545,7 +546,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
return dbEncryptFunction.getDecryptSql(this.getDbColumn());
}
public String getDecryptSql(String tableAlias) {
private String getDecryptSql(String tableAlias) {
return dbEncryptFunction.getDecryptSql(tableAlias + "." + this.getDbColumn());
}
@@ -702,7 +703,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return true if this object is part of an inheritance hierarchy.
*/
public boolean isInherited() {
private boolean isInherited() {
return inherited;
}
@@ -728,21 +729,21 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return the DB literal expression to set the deleted state to true.
*/
public String getSoftDeleteDbSet() {
String getSoftDeleteDbSet() {
return softDeleteDbSet;
}
/**
* Return the DB literal predicate used to filter out soft deleted rows from a query.
*/
public String getSoftDeleteDbPredicate(String tableAlias) {
String getSoftDeleteDbPredicate(String tableAlias) {
return tableAlias + softDeleteDbPredicate;
}
/**
* Set the soft delete property value on the bean without invoking lazy loading.
*/
public void setSoftDeleteValue(EntityBean bean) {
void setSoftDeleteValue(EntityBean bean) {
// assumes boolean deleted true being set which is ok limitation for now
setValue(bean, true);
bean._ebean_getIntercept().setChangedProperty(propertyIndex);
@@ -909,7 +910,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return the name of the property.
*/
@Override
@Override @Nonnull
public String getName() {
return name;
}
@@ -1018,7 +1019,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
* Return true if the mutable value is considered dirty.
* This is only used for 'mutable' scalar types like hstore etc.
*/
public boolean isDirtyValue(Object value) {
boolean isDirtyValue(Object value) {
return scalarType.isDirty(value);
}
@@ -1061,14 +1062,14 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return the DB scale for numeric columns.
*/
public int getDbScale() {
private int getDbScale() {
return dbScale;
}
/**
* Return a specific column DDL definition if specified (otherwise null).
*/
public String getDbColumnDefn() {
private String getDbColumnDefn() {
return dbColumnDefn;
}
@@ -1112,7 +1113,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return the bean Field associated with this property.
*/
public Field getField() {
private Field getField() {
return field;
}
@@ -1148,14 +1149,14 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return true if this is a generated property mapping to @WhenCreated or @CreatedTimestamp.
*/
public boolean isGeneratedWhenCreated() {
boolean isGeneratedWhenCreated() {
return generatedProperty instanceof GeneratedWhenCreated;
}
/**
* Return true if this is a generated property mapping to @WhenModified or @UpdatedTimestamp.
*/
public boolean isGeneratedWhenModified() {
boolean isGeneratedWhenModified() {
return generatedProperty instanceof GeneratedWhenModified;
}
@@ -1191,7 +1192,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
* Return true if this is a draftOnly property on a non-asDraft query and as such this
* property should not be included in a sql query.
*/
protected boolean ignoreDraftOnlyProperty(boolean draftQuery) {
private boolean ignoreDraftOnlyProperty(boolean draftQuery) {
return draftOnly && !draftQuery;
}
@@ -1232,7 +1233,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Perform DB to Logical type conversion (if necessary).
*/
public Object convertToLogicalType(Object value) {
private Object convertToLogicalType(Object value) {
if (scalarType != null) {
return scalarType.toBeanType(value);
}
@@ -1358,7 +1359,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return true if this property is reset/cleared on publish (on the draft bean).
*/
public boolean isDraftReset() {
boolean isDraftReset() {
return draftReset;
}
@@ -1386,7 +1387,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return true if this property is included in database queries.
*/
public boolean isDbRead() {
private boolean isDbRead() {
return dbRead;
}
@@ -1401,7 +1402,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Return the property type.
*/
@Override
@Override @Nonnull
public Class<?> getPropertyType() {
return propertyType;
}
@@ -1533,7 +1534,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Populate diff map comparing the property values.
*/
public void diffVal(String prefix, Map<String, ValuePair> map, Object newVal, Object oldVal) {
void diffVal(String prefix, Map<String, ValuePair> map, Object newVal, Object oldVal) {
if (!ValueUtil.areEqual(newVal, oldVal)) {
String propName = (prefix == null) ? name : prefix + "." + name;
map.put(propName, new ValuePair(newVal, oldVal));
@@ -53,7 +53,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Derived list of exported property and matching foreignKey
*/
protected ExportedProperty[] exportedProperties;
ExportedProperty[] exportedProperties;
/**
* Persist settings.
@@ -70,7 +70,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* The type of the joined bean.
*/
final Class<T> targetType;
private final Class<T> targetType;
/**
* The join table information.
@@ -79,18 +79,18 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
final String mappedBy;
final String docStoreDoc;
private final String docStoreDoc;
final String extraWhere;
private final String extraWhere;
final int fetchPreference;
private final int fetchPreference;
boolean saveRecurseSkippable;
private boolean saveRecurseSkippable;
/**
* Construct the property.
*/
public BeanPropertyAssoc(BeanDescriptor<?> descriptor, DeployBeanPropertyAssoc<T> deploy) {
BeanPropertyAssoc(BeanDescriptor<?> descriptor, DeployBeanPropertyAssoc<T> deploy) {
super(descriptor, deploy);
this.foreignKey = deploy.getForeignKey();
this.extraWhere = InternString.intern(deploy.getExtraWhere());
@@ -108,7 +108,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
* Copy constructor for ManyToOne inside Embeddable.
*/
@SuppressWarnings("unchecked")
public BeanPropertyAssoc(BeanPropertyAssoc source, BeanPropertyOverride override) {
BeanPropertyAssoc(BeanPropertyAssoc source, BeanPropertyOverride override) {
super(source, override);
foreignKey = source.foreignKey;
extraWhere = source.extraWhere;
@@ -172,7 +172,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Create a ElPropertyValue for a *ToOne or *ToMany.
*/
protected ElPropertyValue createElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) {
ElPropertyValue createElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) {
// associated or embedded bean
BeanDescriptor<?> embDesc = getTargetDescriptor();
@@ -269,12 +269,11 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Return true if REFRESH should cascade.
*/
public boolean isCascadeRefresh() {
boolean isCascadeRefresh() {
return cascadeInfo.isRefresh();
}
public boolean isSaveRecurseSkippable(Object bean) {
return saveRecurseSkippable && bean instanceof EntityBean && !((EntityBean) bean)._ebean_getIntercept().isNewOrDirty();
}
@@ -298,14 +297,8 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
BeanDescriptor<?> targetDesc = getTargetDescriptor();
BeanProperty idProp = targetDesc.getIdProperty();
if (idProp != null) {
Object value = idProp.getValue(bean);
if (value == null) {
return false;
}
}
// all the unique properties are non-null
return true;
return idProp == null || idProp.getValue(bean) != null;
}
/**
@@ -331,7 +324,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Return the elastic search doc for this embedded property.
*/
public String getDocStoreDoc() {
private String getDocStoreDoc() {
return docStoreDoc;
}
@@ -362,7 +355,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Include the property in the document store by default.
*/
protected void docStoreIncludeByDefault(PathProperties pathProps) {
void docStoreIncludeByDefault(PathProperties pathProps) {
pathProps.addToPath(null, name);
}
@@ -444,7 +437,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
* Build the list of imported property. Matches BeanProperty from the target
* descriptor back to local database columns in the TableJoin.
*/
protected ImportedId createImportedId(BeanPropertyAssoc<?> owner, BeanDescriptor<?> target, TableJoin join) {
ImportedId createImportedId(BeanPropertyAssoc<?> owner, BeanDescriptor<?> target, TableJoin join) {
BeanProperty idProp = target.getIdProperty();
BeanProperty[] others = target.propertiesBaseScalar();
@@ -9,6 +9,7 @@ import io.ebean.bean.BeanCollection.ModifyListenMode;
import io.ebean.bean.BeanCollectionAdd;
import io.ebean.bean.EntityBean;
import io.ebean.bean.PersistenceContext;
import io.ebean.plugin.PropertyAssocMany;
import io.ebean.text.PathProperties;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiExpressionRequest;
@@ -37,7 +38,7 @@ import java.util.Map;
/**
* Property mapped to a List Set or Map.
*/
public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements STreePropertyAssocMany {
public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements STreePropertyAssocMany, PropertyAssocMany {
private static final Logger logger = LoggerFactory.getLogger(BeanPropertyAssocMany.class);
@@ -105,7 +106,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
/**
* Property on the 'child' bean that links back to the 'master'.
*/
protected BeanPropertyAssocOne<?> childMasterProperty;
private BeanPropertyAssocOne<?> childMasterProperty;
private String childMasterIdProperty;
@@ -201,7 +202,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
/**
* Initialise after the target bean descriptors have been all set.
*/
public void initialisePostTarget() {
void initialisePostTarget() {
if (childMasterProperty != null) {
BeanProperty masterId = childMasterProperty.getTargetDescriptor().getIdProperty();
if (masterId != null) { // in docstore only, the master-id may be not available
@@ -348,6 +349,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
*
* Helper method used by Elastic integration when loading with a persistence context.
*/
@Override
public void lazyLoadMany(EntityBean current) {
EntityBean parentBean = childMasterProperty.getValueAsEntityBean(current);
if (parentBean != null) {
@@ -636,8 +638,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
return help.createEmpty(parentBean);
}
public BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
return help.getBeanCollectionAdd(bc, mapKey);
private BeanCollectionAdd getBeanCollectionAdd(Object bc) {
return help.getBeanCollectionAdd(bc, null);
}
public Object getParentId(EntityBean parentBean) {
@@ -782,7 +784,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
/**
* Register the mapping of intersection table to associated draft table.
*/
public void registerDraftIntersectionTable(BeanDescriptorInitContext initContext) {
void registerDraftIntersectionTable(BeanDescriptorInitContext initContext) {
if (hasDraftIntersection()) {
initContext.addDraftIntersection(intersectionPublishTable, intersectionDraftTable);
}
@@ -883,7 +885,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
}
@SuppressWarnings("unchecked")
public void publishMany(EntityBean draft, EntityBean live) {
void publishMany(EntityBean draft, EntityBean live) {
// collections will not be null due to enhancement
BeanCollection<T> draftVal = (BeanCollection<T>) getValueIntercept(draft);
@@ -959,11 +961,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
return help;
}
public void jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry<?, ?> entry) throws IOException {
void jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry<?, ?> entry) throws IOException {
elementDescriptor.jsonWriteMapEntry(ctx, entry);
}
public void jsonWriteElementValue(SpiJsonWriter ctx, Object element) {
void jsonWriteElementValue(SpiJsonWriter ctx, Object element) {
elementDescriptor.jsonWriteElement(ctx, element);
}
@@ -1011,7 +1013,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
/**
* Read the collection as JSON.
*/
public Object jsonReadCollection(String json) throws IOException {
private Object jsonReadCollection(String json) throws IOException {
SpiJsonReader ctx = descriptor.createJsonReader(json);
JsonParser parser = ctx.getParser();
JsonToken event = parser.nextToken();
@@ -1024,7 +1026,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
/**
* Write the collection to JSON.
*/
public void jsonWriteCollection(SpiJsonWriter ctx, String name, Object value, boolean explicitInclude) throws IOException {
private void jsonWriteCollection(SpiJsonWriter ctx, String name, Object value, boolean explicitInclude) throws IOException {
help.jsonWrite(ctx, name, value, explicitInclude);
}
@@ -1038,7 +1040,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
}
BeanCollection<?> collection = createEmpty(parentBean);
BeanCollectionAdd add = getBeanCollectionAdd(collection, null);
BeanCollectionAdd add = getBeanCollectionAdd(collection);
do {
EntityBean detailBean = (EntityBean) targetDescriptor.jsonRead(readJson, name);
if (detailBean == null) {
@@ -47,7 +47,7 @@ class BeanPropertyAssocManySqlHelp<T> {
StringBuilder sb = new StringBuilder(200);
sb.append("insert into ").append(many.targetTable()).append(" (");
append(sb, "", ",", "");
append(sb);
Cols cols = new Cols(sb);
VisitAllUsing.visitOne(many.targetDescriptor, cols);
@@ -59,7 +59,7 @@ class BeanPropertyAssocManySqlHelp<T> {
return sb.toString();
}
public String insertElementCollection() {
String insertElementCollection() {
return elementCollectionInsertSql;
}
@@ -191,16 +191,16 @@ class BeanPropertyAssocManySqlHelp<T> {
}
}
private void append(StringBuilder sb, String tableAlias, String prefix, String suffix) {
private void append(StringBuilder sb) {
for (int i = 0; i < exportedProperties.length; i++) {
String fkColumn = exportedProperties[i].getForeignDbColumn();
if (i > 0) {
sb.append(prefix);
sb.append(",");
}
sb.append(tableAlias).append(fkColumn);
sb.append(suffix);
sb.append(fkColumn);
}
}
private String deriveWhereParentIdSql(boolean inClause, String tableAlias) {
StringBuilder sb = new StringBuilder();
@@ -49,11 +49,11 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
private AssocOneHelp localHelp;
protected final BeanProperty[] embeddedProps;
final BeanProperty[] embeddedProps;
private final HashMap<String, BeanProperty> embeddedPropsMap;
protected ImportedId importedId;
ImportedId importedId;
private String deleteByParentIdSql;
private String deleteByParentIdInSql;
@@ -157,7 +157,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
/**
* Derive late in lifecycle cache notification on this relationship.
*/
public void initialisePostTarget() {
void initialisePostTarget() {
this.cacheNotifyRelationship = isCacheNotifyRelationship();
}
@@ -465,7 +465,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
return targetDescriptor.getIdProperty();
}
public ScalarType getIdScalarType() {
ScalarType getIdScalarType() {
return targetDescriptor.getIdProperty().scalarType;
}
@@ -674,7 +674,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
}
}
void setEmbeddedOwner(EntityBean bean, Object value) {
private void setEmbeddedOwner(EntityBean bean, Object value) {
((EntityBean) value)._ebean_getIntercept().setEmbeddedOwner(bean, propertyIndex);
}
@@ -9,11 +9,11 @@ import io.ebeaninternal.server.core.InternString;
* Typically this is for Embedded Beans.
* </p>
*/
public class BeanPropertyOverride {
class BeanPropertyOverride {
private final String dbColumn;
public BeanPropertyOverride(String dbColumn) {
BeanPropertyOverride(String dbColumn) {
this.dbColumn = InternString.intern(dbColumn);
}
@@ -11,25 +11,25 @@ import java.util.List;
/**
* Default implementation for creating BeanControllers.
*/
public class BeanQueryAdapterManager {
class BeanQueryAdapterManager {
private static final Logger logger = LoggerFactory.getLogger(BeanQueryAdapterManager.class);
private final List<BeanQueryAdapter> list;
public BeanQueryAdapterManager(BootupClasses bootupClasses) {
BeanQueryAdapterManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanQueryAdapters();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Return the BeanPersistController for a given entity type.
*/
public void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
for (BeanQueryAdapter c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
@@ -10,45 +10,45 @@ public abstract class DeployParser {
/**
* used to identify sql literal.
*/
protected static final char SINGLE_QUOTE = '\'';
private static final char SINGLE_QUOTE = '\'';
/**
* used to identify query named parameters.
*/
protected static final char COLON = ':';
private static final char COLON = ':';
/**
* Used to determine when a column name terminates.
*/
protected static final char UNDERSCORE = '_';
private static final char UNDERSCORE = '_';
protected static final char OPEN_SQUARE_BRACKET = '[';
protected static final char CLOSE_SQUARE_BRACKET = ']';
protected static final char DOUBLE_QUOTE = '\"';
protected static final char BACK_QUOTE = '`';
private static final char OPEN_SQUARE_BRACKET = '[';
private static final char CLOSE_SQUARE_BRACKET = ']';
private static final char DOUBLE_QUOTE = '\"';
private static final char BACK_QUOTE = '`';
/**
* Used to determine when a column name terminates.
*/
protected static final char PERIOD = '.';
private static final char PERIOD = '.';
protected static final char OPEN_BRACKET = '(';
private static final char OPEN_BRACKET = '(';
protected boolean encrypted;
boolean encrypted;
protected String source;
private String source;
protected StringBuilder sb;
private StringBuilder sb;
protected int sourceLength;
private int sourceLength;
protected int pos;
private int pos;
protected String priorWord;
String priorWord;
protected String word;
String word;
protected char wordTerminator;
private char wordTerminator;
private StringBuilder wordBuffer;
@@ -98,7 +98,7 @@ public abstract class DeployParser {
return sb.toString();
}
protected boolean skipWordConvert() {
boolean skipWordConvert() {
return false;
}
@@ -11,9 +11,9 @@ import java.util.List;
*/
abstract class DynamicPropertyBase implements STreeProperty {
final String name;
private final String name;
final String fullName;
final String elPrefix;
private final String elPrefix;
final ScalarType<?> scalarType;
DynamicPropertyBase(String name, String fullName, String elPrefix, ScalarType<?> scalarType) {
@@ -6,7 +6,7 @@ import java.lang.reflect.Type;
/**
* Helper object to find generic parameter types for a given class.
*/
public class ParamTypeUtil {
class ParamTypeUtil {
/**
* Find and return the parameter type given a generic interface or class.
@@ -11,25 +11,25 @@ import java.util.List;
/**
* Default implementation for creating BeanControllers.
*/
public class PersistControllerManager {
class PersistControllerManager {
private static final Logger logger = LoggerFactory.getLogger(PersistControllerManager.class);
private final List<BeanPersistController> list;
public PersistControllerManager(BootupClasses bootupClasses) {
PersistControllerManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanPersistControllers();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Return the BeanPersistController for a given entity type.
*/
public void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
for (BeanPersistController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
@@ -12,24 +12,24 @@ import java.util.List;
* Manages the assignment/registration of BeanPersistListener with their
* respective DeployBeanDescriptor's.
*/
public class PersistListenerManager {
class PersistListenerManager {
private static final Logger logger = LoggerFactory.getLogger(PersistListenerManager.class);
private final List<BeanPersistListener> list;
public PersistListenerManager(BootupClasses bootupClasses) {
PersistListenerManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanPersistListeners();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Return the BeanPersistController for a given entity type.
*/
public <T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
<T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
for (BeanPersistListener listener : list) {
if (listener.isRegisterFor(deployDesc.getBeanType())) {
@@ -11,24 +11,24 @@ import java.util.List;
/**
* Default implementation for creating BeanControllers.
*/
public class PostConstructManager {
class PostConstructManager {
private static final Logger logger = LoggerFactory.getLogger(PostConstructManager.class);
private final List<BeanPostConstructListener> list;
public PostConstructManager(BootupClasses bootupClasses) {
PostConstructManager(BootupClasses bootupClasses) {
this.list = bootupClasses.getBeanPostConstructoListeners();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Register BeanPostLoad listeners for a given entity type.
*/
public void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostConstructListener c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
@@ -11,24 +11,24 @@ import java.util.List;
/**
* Default implementation for creating BeanControllers.
*/
public class PostLoadManager {
class PostLoadManager {
private static final Logger logger = LoggerFactory.getLogger(PostLoadManager.class);
private final List<BeanPostLoad> list;
public PostLoadManager(BootupClasses bootupClasses) {
PostLoadManager(BootupClasses bootupClasses) {
this.list = bootupClasses.getBeanPostLoaders();
}
public int getRegisterCount() {
int getRegisterCount() {
return list.size();
}
/**
* Register BeanPostLoad listeners for a given entity type.
*/
public void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostLoad c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
@@ -56,7 +56,7 @@ public class TableJoinColumn {
this.queryHash = hash();
}
int hash() {
private int hash() {
int result = localDbColumn != null ? localDbColumn.hashCode() : 0;
result = 92821 * result + (foreignDbColumn != null ? foreignDbColumn.hashCode() : 0);
result = 92821 * result + (localSqlFormula != null ? localSqlFormula.hashCode() : 0);
@@ -93,7 +93,7 @@ public class TableJoinColumn {
/**
* Return a hash for including in a query plan.
*/
public int queryHash() {
int queryHash() {
return queryHash;
}
@@ -121,7 +121,7 @@ public class TableJoinColumn {
/**
* Return true if this column should be updateable.
*/
public boolean isUpdateable() {
boolean isUpdateable() {
return updateable;
}
@@ -13,11 +13,11 @@ import java.sql.Types;
* Aka, Integer, Long, Short etc.
* </p>
*/
public class CounterFactory {
class CounterFactory {
final GeneratedCounterInteger integerCounter = new GeneratedCounterInteger();
private final GeneratedCounterInteger integerCounter = new GeneratedCounterInteger();
final GeneratedCounterLong longCounter = new GeneratedCounterLong();
private final GeneratedCounterLong longCounter = new GeneratedCounterLong();
public void setCounter(DeployBeanProperty property) {
@@ -9,9 +9,9 @@ import io.ebeaninternal.server.deploy.BeanProperty;
*/
public class GeneratedCounter implements GeneratedProperty {
final int numberType;
private final int numberType;
public GeneratedCounter(int numberType) {
GeneratedCounter(int numberType) {
this.numberType = numberType;
}
@@ -87,7 +87,7 @@ public class GeneratedPropertyFactory {
}
}
public void setCounter(DeployBeanProperty property) {
private void setCounter(DeployBeanProperty property) {
counterFactory.setCounter(property);
}
@@ -9,9 +9,9 @@ import io.ebeaninternal.server.deploy.BeanProperty;
*/
public class GeneratedWhoCreated implements GeneratedProperty {
final CurrentUserProvider currentUserProvider;
private final CurrentUserProvider currentUserProvider;
public GeneratedWhoCreated(CurrentUserProvider currentUserProvider) {
GeneratedWhoCreated(CurrentUserProvider currentUserProvider) {
this.currentUserProvider = currentUserProvider;
}
@@ -9,9 +9,9 @@ import io.ebeaninternal.server.deploy.BeanProperty;
*/
public class GeneratedWhoModified implements GeneratedProperty {
final CurrentUserProvider currentUserProvider;
private final CurrentUserProvider currentUserProvider;
public GeneratedWhoModified(CurrentUserProvider currentUserProvider) {
GeneratedWhoModified(CurrentUserProvider currentUserProvider) {
this.currentUserProvider = currentUserProvider;
}
@@ -15,13 +15,13 @@ import java.util.Map;
/**
* Helper for creating Insert timestamp GeneratedProperty objects.
*/
public class InsertTimestampFactory {
class InsertTimestampFactory {
final GeneratedInsertLong longTime = new GeneratedInsertLong();
private final GeneratedInsertLong longTime = new GeneratedInsertLong();
final Map<Class<?>, GeneratedProperty> map = new HashMap<>();
private final Map<Class<?>, GeneratedProperty> map = new HashMap<>();
public InsertTimestampFactory(ClassLoadConfig classLoadConfig) {
InsertTimestampFactory(ClassLoadConfig classLoadConfig) {
map.put(Timestamp.class, new GeneratedInsertTimestamp());
map.put(java.util.Date.class, new GeneratedInsertDate());
map.put(Long.class, longTime);
@@ -40,7 +40,7 @@ public class InsertTimestampFactory {
}
public void setInsertTimestamp(DeployBeanProperty property) {
void setInsertTimestamp(DeployBeanProperty property) {
property.setGeneratedProperty(createInsertTimestamp(property));
}
@@ -48,7 +48,7 @@ public class InsertTimestampFactory {
/**
* Create the insert GeneratedProperty depending on the property type.
*/
public GeneratedProperty createInsertTimestamp(DeployBeanProperty property) {
GeneratedProperty createInsertTimestamp(DeployBeanProperty property) {
Class<?> propType = property.getPropertyType();
GeneratedProperty generatedProperty = map.get(propType);
@@ -9,7 +9,7 @@ import java.time.ZonedDateTime;
/**
* Helper methods for Java time conversion.
*/
public class JavaTimeUtils {
class JavaTimeUtils {
/**
* Return the system millis time as a LocalDateTime.
@@ -21,21 +21,21 @@ public class JavaTimeUtils {
/**
* Return the system millis time as a LocalDateTime.
*/
public static Object toLocalDateTime(long systemMillis) {
static Object toLocalDateTime(long systemMillis) {
return new Timestamp(systemMillis).toLocalDateTime();
}
/**
* Return the system millis time as a OffsetDateTime.
*/
public static Object toOffsetDateTime(long systemMillis) {
static Object toOffsetDateTime(long systemMillis) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(systemMillis), ZoneId.systemDefault());
}
/**
* Return the system millis time as a ZonedDateTime.
*/
public static Object toZonedDateTime(long systemMillis) {
static Object toZonedDateTime(long systemMillis) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(systemMillis), ZoneId.systemDefault());
}
}
@@ -15,13 +15,13 @@ import java.util.Map;
/**
* Helper for creating Update timestamp GeneratedProperty objects.
*/
public class UpdateTimestampFactory {
class UpdateTimestampFactory {
final GeneratedUpdateLong longTime = new GeneratedUpdateLong();
private final GeneratedUpdateLong longTime = new GeneratedUpdateLong();
final Map<Class<?>, GeneratedProperty> map = new HashMap<>();
private final Map<Class<?>, GeneratedProperty> map = new HashMap<>();
public UpdateTimestampFactory(ClassLoadConfig classLoadConfig) {
UpdateTimestampFactory(ClassLoadConfig classLoadConfig) {
map.put(Timestamp.class, new GeneratedUpdateTimestamp());
map.put(java.util.Date.class, new GeneratedUpdateDate());
map.put(Long.class, longTime);
@@ -39,7 +39,7 @@ public class UpdateTimestampFactory {
}
}
public void setUpdateTimestamp(DeployBeanProperty property) {
void setUpdateTimestamp(DeployBeanProperty property) {
property.setGeneratedProperty(createUpdateTimestamp(property));
}
@@ -47,7 +47,7 @@ public class UpdateTimestampFactory {
/**
* Create the update GeneratedProperty depending on the property type.
*/
protected GeneratedProperty createUpdateTimestamp(DeployBeanProperty property) {
GeneratedProperty createUpdateTimestamp(DeployBeanProperty property) {
Class<?> propType = property.getPropertyType();
GeneratedProperty generatedProperty = map.get(propType);
@@ -35,17 +35,17 @@ public final class ImportedIdSimple implements ImportedId, Comparable<ImportedId
private static final EntryComparator COMPARATOR = new EntryComparator();
protected final BeanPropertyAssoc<?> owner;
final BeanPropertyAssoc<?> owner;
protected final String localDbColumn;
final String localDbColumn;
protected final String localSqlFormula;
private final String localSqlFormula;
protected final String logicalName;
private final String logicalName;
protected final BeanProperty foreignProperty;
final BeanProperty foreignProperty;
protected final int position;
private final int position;
/**
* If true include in insert.
@@ -88,7 +88,7 @@ public final class ImportedIdSimple implements ImportedId, Comparable<ImportedId
/**
* Return true if it should be included in the update (or insert).
*/
public boolean isInclude(boolean update) {
boolean isInclude(boolean update) {
return (update) ? updateable : insertable;
}
@@ -206,7 +206,7 @@ public class DeployBeanProperty {
*/
private GeneratedProperty generatedProperty;
protected final DeployBeanDescriptor<?> desc;
final DeployBeanDescriptor<?> desc;
private boolean undirectionalShadow;
@@ -329,7 +329,7 @@ public class DeployBeanProperty {
/**
* Return the sortOrder for the properties.
*/
public int getSortOrder() {
int getSortOrder() {
return sortOrder;
}
@@ -357,7 +357,7 @@ public class DeployBeanProperty {
/**
* Mark this property as mapping to the discriminator column.
*/
public void setDiscriminator() {
void setDiscriminator() {
this.discriminator = true;
}
@@ -524,7 +524,7 @@ public class DeployBeanProperty {
return naturalKey;
}
public void setNaturalKey() {
void setNaturalKey() {
this.naturalKey = true;
}
@@ -763,7 +763,7 @@ public class DeployBeanProperty {
return lob;
}
public boolean isDbNumberType() {
boolean isDbNumberType() {
return isNumericType(dbType);
}
@@ -12,7 +12,7 @@ public abstract class DeployBeanPropertyAssoc<T> extends DeployBeanProperty {
/**
* The type of the joined bean.
*/
protected Class<T> targetType;
Class<T> targetType;
/**
* Persist settings.
@@ -27,7 +27,7 @@ public abstract class DeployBeanPropertyAssoc<T> extends DeployBeanProperty {
/**
* Join between the beans.
*/
protected final DeployTableJoin tableJoin = new DeployTableJoin();
final DeployTableJoin tableJoin = new DeployTableJoin();
/**
* Literal added to where clause of lazy loading query.
@@ -13,27 +13,26 @@ public class DeployTableJoinColumn {
/**
* The local database column name.
*/
String localDbColumn;
private String localDbColumn;
/**
* SQL formula used for local column
*/
String localSqlFormula;
private String localSqlFormula;
/**
* The foreign database column name.
*/
String foreignDbColumn;
private String foreignDbColumn;
/**
* SQL formula used for foreign column
*/
String foreignSqlFormula;
private String foreignSqlFormula;
boolean insertable;
boolean updateable;
private boolean insertable;
private boolean updateable;
/**
* Construct when automatically determining the join.
@@ -55,7 +54,7 @@ public class DeployTableJoinColumn {
this.updateable = updateable;
}
public void setLocalSqlFormula(String localSqlFormula) {
void setLocalSqlFormula(String localSqlFormula) {
if (localSqlFormula != null) {
this.localSqlFormula = localSqlFormula;
this.localDbColumn = null;
@@ -178,7 +177,7 @@ public class DeployTableJoinColumn {
/**
* Set the local database column name.
*/
public void setLocalDbColumn(String localDbColumn) {
void setLocalDbColumn(String localDbColumn) {
this.localDbColumn = localDbColumn;
}
@@ -38,12 +38,12 @@ import java.util.Set;
* <p>This means, searching for <code>JoinColumn</code> will find them also if they are inside a
* <code>JoinColumn<b>s</b></code> annotation</p>
*/
public abstract class AnnotationBase {
abstract class AnnotationBase {
protected final DatabasePlatform databasePlatform;
protected final Platform platform;
protected final NamingConvention namingConvention;
protected final DeployUtil util;
final DatabasePlatform databasePlatform;
private final Platform platform;
final NamingConvention namingConvention;
final DeployUtil util;
AnnotationBase(DeployUtil util) {
this.util = util;
@@ -60,7 +60,7 @@ public abstract class AnnotationBase {
/**
* Checks string is null or empty .
*/
protected boolean isEmpty(String s) {
boolean isEmpty(String s) {
return s == null || s.trim().isEmpty();
}
@@ -78,7 +78,7 @@ public abstract class AnnotationBase {
* </p>
* <p>
*/
protected <T extends Annotation> T get(DeployBeanProperty prop, Class<T> annClass) {
<T extends Annotation> T get(DeployBeanProperty prop, Class<T> annClass) {
T a = null;
Field field = prop.getField();
if (field != null) {
@@ -97,7 +97,7 @@ public abstract class AnnotationBase {
* Return all annotations for this property. Annotations are not filtered by platfrom and you'll get
* really all annotations that are directly, indirectly or meta-present.
*/
protected <T extends Annotation> Set<T> getAll(DeployBeanProperty prop, Class<T> annClass) {
<T extends Annotation> Set<T> getAll(DeployBeanProperty prop, Class<T> annClass) {
Set<T> ret = null;
Field field = prop.getField();
if (field != null) {
@@ -121,7 +121,7 @@ public abstract class AnnotationBase {
* (This is used for SequenceGenerator e.g.)
* </p>
*/
protected <T extends Annotation> T find(DeployBeanProperty prop, Class<T> annClass) {
<T extends Annotation> T find(DeployBeanProperty prop, Class<T> annClass) {
T a = get(prop, annClass);
if (a == null) {
a = AnnotationUtil.findAnnotation(prop.getOwningType(), annClass, platform);
@@ -19,11 +19,11 @@ import java.util.UUID;
*/
public abstract class AnnotationParser extends AnnotationBase {
protected final DeployBeanInfo<?> info;
final DeployBeanInfo<?> info;
protected final DeployBeanDescriptor<?> descriptor;
final DeployBeanDescriptor<?> descriptor;
protected final Class<?> beanType;
final Class<?> beanType;
final boolean validationAnnotations;