mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - format only
This commit is contained in:
@@ -42,43 +42,32 @@ public class BootupClasses implements ClassFilter {
|
||||
|
||||
private final List<Class<?>> entityList = new ArrayList<Class<?>>();
|
||||
|
||||
private final List<Class<? extends ScalarType<?>>> scalarTypeList
|
||||
= new ArrayList<Class<? extends ScalarType<?>>>();
|
||||
private final List<Class<? extends ScalarType<?>>> scalarTypeList = new ArrayList<Class<? extends ScalarType<?>>>();
|
||||
|
||||
private final List<Class<? extends ScalarTypeConverter<?, ?>>> scalarConverterList
|
||||
= new ArrayList<Class<? extends ScalarTypeConverter<?, ?>>>();
|
||||
private final List<Class<? extends ScalarTypeConverter<?, ?>>> scalarConverterList = new ArrayList<Class<? extends ScalarTypeConverter<?, ?>>>();
|
||||
|
||||
private final List<Class<? extends CompoundType<?>>> compoundTypeList = new ArrayList<Class<? extends CompoundType<?>>>();
|
||||
|
||||
private final List<Class<? extends CompoundType<?>>> compoundTypeList
|
||||
= new ArrayList<Class<? extends CompoundType<?>>>();
|
||||
|
||||
|
||||
// The following objects are instantiiated on first request
|
||||
// there is always a candidate list, that holds the class and an
|
||||
// instance list, that holds the instance. Once a class is instantiiated
|
||||
// (or added) it will get removed from the candidate list
|
||||
private final List<Class<? extends IdGenerator>> idGeneratorCandidates
|
||||
= new ArrayList<Class<? extends IdGenerator>>();
|
||||
|
||||
private final List<Class<? extends BeanPersistController>> beanPersistControllerCandidates
|
||||
= new ArrayList<Class<? extends BeanPersistController>>();
|
||||
|
||||
private final List<Class<? extends BeanPostLoad>> beanPostLoadCandidates
|
||||
= new ArrayList<Class<? extends BeanPostLoad>>();
|
||||
private final List<Class<? extends IdGenerator>> idGeneratorCandidates = new ArrayList<Class<? extends IdGenerator>>();
|
||||
|
||||
private final List<Class<? extends BeanPostConstructListener>> beanPostConstructListenerCandidates
|
||||
= new ArrayList<Class<? extends BeanPostConstructListener>>();
|
||||
|
||||
private final List<Class<? extends BeanFindController>> beanFindControllerCandidates
|
||||
= new ArrayList<Class<? extends BeanFindController>>();
|
||||
|
||||
private final List<Class<? extends BeanPersistListener>> beanPersistListenerCandidates
|
||||
= new ArrayList<Class<? extends BeanPersistListener>>();
|
||||
|
||||
private final List<Class<? extends BeanQueryAdapter>> beanQueryAdapterCandidates
|
||||
= new ArrayList<Class<? extends BeanQueryAdapter>>();
|
||||
|
||||
private final List<Class<? extends ServerConfigStartup>> serverConfigStartupCandidates
|
||||
= new ArrayList<Class<? extends ServerConfigStartup>>();
|
||||
private final List<Class<? extends BeanPersistController>> beanPersistControllerCandidates = new ArrayList<Class<? extends BeanPersistController>>();
|
||||
|
||||
private final List<Class<? extends BeanPostLoad>> beanPostLoadCandidates = new ArrayList<Class<? extends BeanPostLoad>>();
|
||||
|
||||
private final List<Class<? extends BeanPostConstructListener>> beanPostConstructListenerCandidates = new ArrayList<Class<? extends BeanPostConstructListener>>();
|
||||
|
||||
private final List<Class<? extends BeanFindController>> beanFindControllerCandidates = new ArrayList<Class<? extends BeanFindController>>();
|
||||
|
||||
private final List<Class<? extends BeanPersistListener>> beanPersistListenerCandidates = new ArrayList<Class<? extends BeanPersistListener>>();
|
||||
|
||||
private final List<Class<? extends BeanQueryAdapter>> beanQueryAdapterCandidates = new ArrayList<Class<? extends BeanQueryAdapter>>();
|
||||
|
||||
private final List<Class<? extends ServerConfigStartup>> serverConfigStartupCandidates = new ArrayList<Class<? extends ServerConfigStartup>>();
|
||||
|
||||
private final List<IdGenerator> idGeneratorInstances = new ArrayList<IdGenerator>();
|
||||
private final List<BeanPersistController> beanPersistControllerInstances = new ArrayList<BeanPersistController>();
|
||||
@@ -88,7 +77,7 @@ public class BootupClasses implements ClassFilter {
|
||||
private final List<BeanPersistListener> beanPersistListenerInstances = new ArrayList<BeanPersistListener>();
|
||||
private final List<BeanQueryAdapter> beanQueryAdapterInstances = new ArrayList<BeanQueryAdapter>();
|
||||
private final List<ServerConfigStartup> serverConfigStartupInstances = new ArrayList<ServerConfigStartup>();
|
||||
|
||||
|
||||
// single objects
|
||||
private Class<? extends ChangeLogPrepare> changeLogPrepareClass;
|
||||
private Class<? extends ChangeLogListener> changeLogListenerClass;
|
||||
@@ -148,7 +137,7 @@ public class BootupClasses implements ClassFilter {
|
||||
// don't automatically instantiate
|
||||
candidates.remove(obj.getClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,13 +160,14 @@ public class BootupClasses implements ClassFilter {
|
||||
public void addPostLoaders(List<BeanPostLoad> postLoaders) {
|
||||
add(postLoaders, beanPostLoadInstances, beanPostLoadCandidates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add BeanPostConstructListener instances.
|
||||
*/
|
||||
public void addPostConstructListeners(List<BeanPostConstructListener> postConstructListener) {
|
||||
add(postConstructListener, beanPostConstructListenerInstances, beanPostConstructListenerCandidates);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add BeanFindController instances.
|
||||
*/
|
||||
@@ -192,7 +182,7 @@ public class BootupClasses implements ClassFilter {
|
||||
public void addQueryAdapters(List<BeanQueryAdapter> queryAdapters) {
|
||||
add(queryAdapters, beanQueryAdapterInstances, beanQueryAdapterCandidates);
|
||||
}
|
||||
|
||||
|
||||
public void addServerConfigStartup(List<ServerConfigStartup> startupInstances) {
|
||||
add(startupInstances, serverConfigStartupInstances, serverConfigStartupCandidates);
|
||||
}
|
||||
@@ -260,14 +250,14 @@ public class BootupClasses implements ClassFilter {
|
||||
* instantiated only once
|
||||
*/
|
||||
private <T> List<T> createAdd(List<T> instances, List<Class<? extends T>> candidates) {
|
||||
for (Class<? extends T> cls : candidates) {
|
||||
for (Class<? extends T> cls : candidates) {
|
||||
T newInstance = create(cls, true);
|
||||
if (newInstance != null) {
|
||||
instances.add(newInstance);
|
||||
}
|
||||
}
|
||||
candidates.clear(); // important, clear class list!
|
||||
return instances;
|
||||
}
|
||||
candidates.clear(); // important, clear class list!
|
||||
return instances;
|
||||
}
|
||||
|
||||
public ChangeLogPrepare getChangeLogPrepare() {
|
||||
@@ -289,12 +279,11 @@ public class BootupClasses implements ClassFilter {
|
||||
public ReadAuditLogger getReadAuditLogger() {
|
||||
return readAuditLogger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<IdGenerator> getIdGenerators() {
|
||||
return createAdd(idGeneratorInstances, idGeneratorCandidates);
|
||||
}
|
||||
|
||||
|
||||
public List<BeanPersistController> getBeanPersistControllers() {
|
||||
return createAdd(beanPersistControllerInstances, beanPersistControllerCandidates);
|
||||
}
|
||||
@@ -302,7 +291,7 @@ public class BootupClasses implements ClassFilter {
|
||||
public List<BeanPostLoad> getBeanPostLoaders() {
|
||||
return createAdd(beanPostLoadInstances, beanPostLoadCandidates);
|
||||
}
|
||||
|
||||
|
||||
public List<BeanPostConstructListener> getBeanPostConstructoListeners() {
|
||||
return createAdd(beanPostConstructListenerInstances, beanPostConstructListenerCandidates);
|
||||
}
|
||||
@@ -310,15 +299,15 @@ public class BootupClasses implements ClassFilter {
|
||||
public List<BeanFindController> getBeanFindControllers() {
|
||||
return createAdd(beanFindControllerInstances, beanFindControllerCandidates);
|
||||
}
|
||||
|
||||
|
||||
public List<BeanPersistListener> getBeanPersistListeners() {
|
||||
return createAdd(beanPersistListenerInstances, beanPersistListenerCandidates);
|
||||
return createAdd(beanPersistListenerInstances, beanPersistListenerCandidates);
|
||||
}
|
||||
|
||||
|
||||
public List<BeanQueryAdapter> getBeanQueryAdapters() {
|
||||
return createAdd(beanQueryAdapterInstances, beanQueryAdapterCandidates);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of Embeddable classes.
|
||||
*/
|
||||
@@ -388,8 +377,8 @@ public class BootupClasses implements ClassFilter {
|
||||
|
||||
// Types
|
||||
if (ScalarType.class.isAssignableFrom(cls)) {
|
||||
scalarTypeList.add((Class<? extends ScalarType<?>>) cls);
|
||||
interesting = true;
|
||||
scalarTypeList.add((Class<? extends ScalarType<?>>) cls);
|
||||
interesting = true;
|
||||
}
|
||||
|
||||
if (ScalarTypeConverter.class.isAssignableFrom(cls)) {
|
||||
@@ -426,7 +415,7 @@ public class BootupClasses implements ClassFilter {
|
||||
if (BeanFindController.class.isAssignableFrom(cls)) {
|
||||
beanFindControllerCandidates.add((Class<? extends BeanFindController>) cls);
|
||||
interesting = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (BeanPersistListener.class.isAssignableFrom(cls)) {
|
||||
beanPersistListenerCandidates.add((Class<? extends BeanPersistListener>) cls);
|
||||
|
||||
+45
-45
@@ -10,47 +10,47 @@ import java.util.List;
|
||||
*/
|
||||
public class ChainedBeanPostConstructListener implements BeanPostConstructListener {
|
||||
|
||||
private final List<BeanPostConstructListener> list;
|
||||
private final List<BeanPostConstructListener> list;
|
||||
|
||||
private final BeanPostConstructListener[] chain;
|
||||
private final BeanPostConstructListener[] chain;
|
||||
|
||||
/**
|
||||
* Construct given the list of BeanPostCreate's.
|
||||
*/
|
||||
public ChainedBeanPostConstructListener(List<BeanPostConstructListener> list) {
|
||||
this.list = list;
|
||||
this.chain = list.toArray(new BeanPostConstructListener[list.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new BeanPostCreate and return the resulting chain.
|
||||
*/
|
||||
public ChainedBeanPostConstructListener register(BeanPostConstructListener c) {
|
||||
if (list.contains(c)){
|
||||
return this;
|
||||
} else {
|
||||
List<BeanPostConstructListener> newList = new ArrayList<BeanPostConstructListener>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanPostConstructListener(newList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* De-register a BeanPostCreate and return the resulting chain.
|
||||
*/
|
||||
public BeanPostConstructListener deregister(BeanPostConstructListener c) {
|
||||
if (!list.contains(c)){
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPostConstructListener> newList = new ArrayList<BeanPostConstructListener>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanPostConstructListener(newList);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Construct given the list of BeanPostCreate's.
|
||||
*/
|
||||
public ChainedBeanPostConstructListener(List<BeanPostConstructListener> list) {
|
||||
this.list = list;
|
||||
this.chain = list.toArray(new BeanPostConstructListener[list.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new BeanPostCreate and return the resulting chain.
|
||||
*/
|
||||
public ChainedBeanPostConstructListener register(BeanPostConstructListener c) {
|
||||
if (list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
List<BeanPostConstructListener> newList = new ArrayList<BeanPostConstructListener>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanPostConstructListener(newList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* De-register a BeanPostCreate and return the resulting chain.
|
||||
*/
|
||||
public BeanPostConstructListener deregister(BeanPostConstructListener c) {
|
||||
if (!list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPostConstructListener> newList = new ArrayList<BeanPostConstructListener>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanPostConstructListener(newList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the chain.
|
||||
@@ -69,11 +69,11 @@ public class ChainedBeanPostConstructListener implements BeanPostConstructListen
|
||||
* Fire postLoad on all registered BeanPostCreate implementations.
|
||||
*/
|
||||
@Override
|
||||
public void postConstruct(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postConstruct(bean);
|
||||
}
|
||||
}
|
||||
public void postConstruct(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postConstruct(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autowire(Object bean) {
|
||||
@@ -81,7 +81,7 @@ public class ChainedBeanPostConstructListener implements BeanPostConstructListen
|
||||
chain[i].autowire(bean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postCreate(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user