mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
No effective change - code cleanup - removed unused BeanCollectionParams
This commit is contained in:
1 parent
430b3cff96
commit
21b33bb9cd
4 files changed
+22
-87
No files matched your search
@@ -18,58 +18,26 @@ import com.avaje.ebeaninternal.api.SpiQuery;
|
||||
*/
|
||||
public class BeanCollectionFactory {
|
||||
|
||||
private static class BeanCollectionFactoryHolder {
|
||||
private static final BeanCollectionFactory me = new BeanCollectionFactory();
|
||||
}
|
||||
|
||||
private static final int defaultListInitialCapacity = 20;
|
||||
private static final int defaultSetInitialCapacity = 32;
|
||||
private static final int defaultMapInitialCapacity = 32;
|
||||
private static final int defaultListInitialCapacity = 20;
|
||||
private static final int defaultSetInitialCapacity = 32;
|
||||
private static final int defaultMapInitialCapacity = 32;
|
||||
|
||||
private BeanCollectionFactory() {
|
||||
/**
|
||||
* Create a BeanCollection for the given parameters.
|
||||
*/
|
||||
public static BeanCollection<?> create(SpiQuery.Type manyType) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a BeanCollection for the given parameters.
|
||||
*/
|
||||
public static BeanCollection<?> create(BeanCollectionParams params) {
|
||||
return BeanCollectionFactoryHolder.me.createMany(params);
|
||||
}
|
||||
|
||||
|
||||
private BeanCollection<?> createMany(BeanCollectionParams params) {
|
||||
|
||||
SpiQuery.Type manyType = params.getManyType();
|
||||
switch (manyType) {
|
||||
case MAP:
|
||||
return createMap(params);
|
||||
case LIST:
|
||||
return createList(params);
|
||||
case SET:
|
||||
return createSet(params);
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid Arg " + manyType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private BeanMap createMap(BeanCollectionParams params) {
|
||||
|
||||
return new BeanMap(new LinkedHashMap(defaultMapInitialCapacity));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private BeanSet createSet(BeanCollectionParams params) {
|
||||
|
||||
return new BeanSet(new LinkedHashSet(defaultSetInitialCapacity));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private BeanList createList(BeanCollectionParams params) {
|
||||
|
||||
switch (manyType) {
|
||||
case MAP:
|
||||
return new BeanMap(new LinkedHashMap(defaultMapInitialCapacity));
|
||||
case LIST:
|
||||
return new BeanList(new ArrayList(defaultListInitialCapacity));
|
||||
case SET:
|
||||
return new BeanSet(new LinkedHashSet(defaultSetInitialCapacity));
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Invalid Arg " + manyType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.avaje.ebeaninternal.server.util;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiQuery;
|
||||
|
||||
/**
|
||||
* Parameters used to create the specific Map Set or List object.
|
||||
*/
|
||||
public class BeanCollectionParams {
|
||||
|
||||
private final SpiQuery.Type manyType;
|
||||
|
||||
/**
|
||||
* Construct without a specific capacity.
|
||||
*/
|
||||
public BeanCollectionParams(SpiQuery.Type manyType) {
|
||||
this.manyType = manyType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type Map Set or List.
|
||||
*/
|
||||
public SpiQuery.Type getManyType() {
|
||||
return manyType;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user