Merge pull request #854 from 0xbaadf00d/feature/explicit-type-to-diamond

Replace explicit type with <>
This commit is contained in:
Rob Bygrave
2016-11-06 22:54:24 +13:00
committed by GitHub
291 changed files with 743 additions and 743 deletions
@@ -31,7 +31,7 @@ public class TestDeleteByIdCollection extends BaseTestCase {
Assert.assertNotNull(c0Back);
Assert.assertNotNull(c1Back);
List<String> ids = new ArrayList<String>();
List<String> ids = new ArrayList<>();
// also test id type conversion
ids.add("" + c0.getId());
ids.add("" + c1.getId());
@@ -62,7 +62,7 @@ public class TestDeleteByIdCollection extends BaseTestCase {
Assert.assertNotNull(o1Back);
List<Object> ids = new ArrayList<Object>();
List<Object> ids = new ArrayList<>();
// also test id type conversion
ids.add(order0.getId());
ids.add(order1.getId());
@@ -45,7 +45,7 @@ public class TestM2MVanilla extends BaseTestCase {
MUser user = Ebean.find(MUser.class, u0.getUserid());
List<MRole> roleList = new ArrayList<MRole>();
List<MRole> roleList = new ArrayList<>();
roleList.add(r1);
roleList.add(r2);
@@ -17,7 +17,7 @@ public class TestUuidInsertMasterDetail extends BaseTestCase {
UUTwo two = new UUTwo();
two.setName("something");
ArrayList<UUTwo> list = new ArrayList<UUTwo>();
ArrayList<UUTwo> list = new ArrayList<>();
list.add(two);
UUOne one = new UUOne();
@@ -128,7 +128,7 @@ public class TestBatchInsertSimple extends BaseTestCase {
int numOfMasters = 3;
List<UTMaster> masters = new ArrayList<UTMaster>();
List<UTMaster> masters = new ArrayList<>();
for (int i = 0; i < numOfMasters; i++) {
masters.add(createMasterAndDetails(i, 7));
}
@@ -154,7 +154,7 @@ public class TestBatchInsertSimple extends BaseTestCase {
int numOfMasters = 3;
List<UTMaster> masters = new ArrayList<UTMaster>();
List<UTMaster> masters = new ArrayList<>();
for (int i = 0; i < numOfMasters; i++) {
masters.add(createMasterAndDetails(i, 5));
}
@@ -177,7 +177,7 @@ public class TestBatchInsertSimple extends BaseTestCase {
private UTMaster createMasterAndDetails(int masterPos, int size) {
UTMaster master = createMaster(masterPos);
List<UTDetail> details = new ArrayList<UTDetail>();
List<UTDetail> details = new ArrayList<>();
int count = 2 + random.nextInt(size);
@@ -28,7 +28,7 @@ public class TestBatchLazyWithCacheHits extends BaseTestCase {
@Test
public void testOnCacheHit() {
ArrayList<UUOne> inserted = new ArrayList<UUOne>();
ArrayList<UUOne> inserted = new ArrayList<>();
String[] names = "A,B,C,D,E,F,G,H,I,J".split(",");
for (int i = 0; i < names.length; i++) {
inserted.add(insert(names[i]));
@@ -257,7 +257,7 @@ public class TestCacheCollectionIds extends BaseTestCase {
cachedBean = Ebean.find(OCachedBean.class, cachedBean.getId());
cachedBean.setName("mod");
ArrayList<Country> list = new ArrayList<Country>();
ArrayList<Country> list = new ArrayList<>();
list.add(Ebean.find(Country.class, "NZ"));
cachedBean.setCountries(list);
Ebean.save(cachedBean);
@@ -51,7 +51,7 @@ public class TestCKeyIdInExpression extends BaseTestCase {
ROrderPK k2 = new ROrderPK("b", 105);
ROrderPK k3 = new ROrderPK("c", 106);
List<ROrderPK> keys = new ArrayList<ROrderPK>();
List<ROrderPK> keys = new ArrayList<>();
keys.add(k0);
keys.add(k1);
keys.add(k2);
@@ -71,7 +71,7 @@ public class TestCKeyLazyLoad extends BaseTestCase {
int size = details.size();
Assert.assertTrue(size > 0);
List<Object> idList = new ArrayList<Object>();
List<Object> idList = new ArrayList<>();
idList.add(id);
idList.add(id2);
@@ -57,7 +57,7 @@ public class TestOnCascadeDeleteChildrenWithCompositeKeys extends BaseTestCase {
if (isMsSqlServer()) return;
assertEquals(2, Ebean.find(User.class).findList().size());
List<Long> ids = new ArrayList<Long>();
List<Long> ids = new ArrayList<>();
ids.add(1L);
ids.add(2L);
@@ -79,7 +79,7 @@ public class TestOnCascadeDeleteChildrenWithCompositeKeys extends BaseTestCase {
BeanPropertyAssocMany<?> beanProperty = (BeanPropertyAssocMany<?>)beanDescriptor.getBeanProperty("userRoles");
List<Object> ids = new ArrayList<Object>();
List<Object> ids = new ArrayList<>();
ids.add(1L);
ids.add(2L);
@@ -28,7 +28,7 @@ public class LinkQueryPublishTest {
EbeanServer server = Ebean.getDefaultServer();
List<Object> ids = new ArrayList<Object>();
List<Object> ids = new ArrayList<>();
ids.add(link1.getId());
ids.add(link2.getId());
ids.add(link3.getId());
@@ -13,7 +13,7 @@ public class TestConstructorManyAddAll extends BaseTestCase {
@Test
public void test() {
List<MRole> startRoles = new ArrayList<MRole>();
List<MRole> startRoles = new ArrayList<>();
MUser mUser = new MUser(startRoles);
mUser.getRoles();
}
@@ -19,7 +19,7 @@ import java.util.List;
*/
public class TestPropertyChangeSupport extends EbeanTestCase implements PropertyChangeListener {
private int nuofEvents = 0;
private List<PropertyChangeEvent> pces = new ArrayList<PropertyChangeEvent>();
private List<PropertyChangeEvent> pces = new ArrayList<>();
private PropertyChangeEvent lastPce;
public void propertyChange(PropertyChangeEvent evt) {
@@ -21,7 +21,7 @@ public class TestInsertCollection extends BaseTestCase {
Customer cust2 = new Customer();
cust2.setName("bob");
List<Customer> customers = new ArrayList<Customer>();
List<Customer> customers = new ArrayList<>();
customers.add(cust1);
customers.add(cust2);
@@ -51,7 +51,7 @@ public class TestInsertCollection extends BaseTestCase {
Customer cust3 = new Customer();
cust3.setName("mac");
List<Customer> saveList = new ArrayList<Customer>();
List<Customer> saveList = new ArrayList<>();
saveList.add(cust1Check2);
saveList.add(cust3);
@@ -64,7 +64,7 @@ public class TestInsertCollection extends BaseTestCase {
Customer cust3Check = Ebean.find(Customer.class, cust3.getId());
Assert.assertEquals("mac", cust3Check.getName());
List<Customer> deleteList = new ArrayList<Customer>();
List<Customer> deleteList = new ArrayList<>();
deleteList.add(cust1Check3);
deleteList.add(cust3);
deleteList.add(cust2Check2);
@@ -33,7 +33,7 @@ public class TestInsertOnStringKey extends BaseTestCase {
}
private List<OrderItemEntity> toList(OrderItemEntity orderItemEntity) {
List<OrderItemEntity> list = new ArrayList<OrderItemEntity>();
List<OrderItemEntity> list = new ArrayList<>();
list.add(orderItemEntity);
return list;
}
@@ -37,7 +37,7 @@ public class TestCarWheelIud extends BaseTestCase {
w4.setCar(car);
w4.setTire(t4);
List<Wheel> wheels = new ArrayList<Wheel>();
List<Wheel> wheels = new ArrayList<>();
wheels.add(w1);
wheels.add(w2);
wheels.add(w3);
@@ -38,13 +38,13 @@ public class TestDbJson_List extends BaseTestCase {
bean.setPlainBean(new PlainBean("plain", 52));
List<PlainBean> beanList = new ArrayList<PlainBean>();
List<PlainBean> beanList = new ArrayList<>();
beanList.add(new PlainBean("one", 1));
beanList.add(new PlainBean("two", 2));
bean.setBeanList(beanList);
Set<PlainBean> beanSet = new LinkedHashSet<PlainBean>();
Set<PlainBean> beanSet = new LinkedHashSet<>();
beanSet.add(new PlainBean("A", 1));
beanSet.add(new PlainBean("B", 2));
bean.setBeanSet(beanSet);
@@ -20,7 +20,7 @@ public class TestJsonExcludeEmptyList {
bean.setId(99);
bean.setStatus(null);
bean.setOrderDate(null);
bean.setDetails(new ArrayList<OrderDetail>());
bean.setDetails(new ArrayList<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_NULL);
@@ -39,7 +39,7 @@ public class TestJsonExcludeEmptyList {
bean.setId(99);
bean.setStatus(null);
bean.setOrderDate(null);
bean.setDetails(new ArrayList<OrderDetail>());
bean.setDetails(new ArrayList<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_EMPTY);
@@ -17,7 +17,7 @@ public class TestJsonExcludeEmptyMap {
EBasicJsonMap bean = new EBasicJsonMap();
bean.setId(99L);
bean.setContent(new LinkedHashMap<String, Object>());
bean.setContent(new LinkedHashMap<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_NULL);
@@ -34,7 +34,7 @@ public class TestJsonExcludeEmptyMap {
EBasicJsonMap bean = new EBasicJsonMap();
bean.setId(99L);
bean.setContent(new LinkedHashMap<String, Object>());
bean.setContent(new LinkedHashMap<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_EMPTY);
@@ -18,7 +18,7 @@ public class TestJsonExcludeEmptySet {
AttributeHolder bean = new AttributeHolder();
bean.setId(99);
bean.setAttributes(new LinkedHashSet<Attribute>());
bean.setAttributes(new LinkedHashSet<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_NULL);
@@ -35,7 +35,7 @@ public class TestJsonExcludeEmptySet {
AttributeHolder bean = new AttributeHolder();
bean.setId(99);
bean.setAttributes(new LinkedHashSet<Attribute>());
bean.setAttributes(new LinkedHashSet<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_EMPTY);
@@ -20,7 +20,7 @@ public class TestJsonExcludeTransientEmptyList {
EJsonTransientList bean = new EJsonTransientList();
bean.setId(99L);
bean.setFileNames(new ArrayList<String>());
bean.setFileNames(new ArrayList<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_NULL);
@@ -37,7 +37,7 @@ public class TestJsonExcludeTransientEmptyList {
EJsonTransientList bean = new EJsonTransientList();
bean.setId(99L);
bean.setFileNames(new ArrayList<String>());
bean.setFileNames(new ArrayList<>());
JsonWriteOptions options = new JsonWriteOptions();
options.setInclude(JsonConfig.Include.NON_EMPTY);
@@ -21,7 +21,7 @@ public class TestModelAJson {
b.setOneField(1);
b.setTwoField(1);
a.setList(new ArrayList<ModelB>());
a.setList(new ArrayList<>());
a.getList().add(b);
PathProperties pathProperties = PathProperties.parse("(a,list(oneField))");
@@ -32,7 +32,7 @@ public class TestM2MDeleteObjectWithCascadeToM2m extends BaseTestCase {
Role role1 = new Role("RoleOne");
role1.setTenant(tenant1);
Set<Permission> permissions = new HashSet<Permission>();
Set<Permission> permissions = new HashSet<>();
List<Permission> permsList = Ebean.find(Permission.class).findList();
permissions.addAll(permsList);
@@ -36,7 +36,7 @@ public class TestM2MDeleteWithCascade extends BaseTestCase {
MUser notThere = Ebean.find(MUser.class, u0.getUserid());
Assert.assertNull("been deleted", notThere);
List<Object> roleIds = new ArrayList<Object>();
List<Object> roleIds = new ArrayList<>();
Collections.addAll(roleIds, r0.getRoleid(), r1.getRoleid());
int rc = Ebean.find(MRole.class).where().idIn(roleIds).findCount();
@@ -34,7 +34,7 @@ public class TestM2mDeleteObject extends BaseTestCase {
Role role1 = new Role("role");
role1.setTenant(t);
Set<Permission> permissions = new HashSet<Permission>();
Set<Permission> permissions = new HashSet<>();
List<Permission> permsList = Ebean.find(Permission.class).findList();
permissions.addAll(permsList);
@@ -72,7 +72,7 @@ public class TestM2mDeleteObject extends BaseTestCase {
Role role1 = new Role("role");
Set<Permission> permissions = new HashSet<Permission>();
Set<Permission> permissions = new HashSet<>();
permissions.add(p2);
role1.setPermissions(permissions);
Ebean.save(role1);
@@ -19,13 +19,13 @@ public class EArrayBean {
String name;
@DbArray(length = 300)
List<String> phoneNumbers = new ArrayList<String>();
List<String> phoneNumbers = new ArrayList<>();
@DbArray
List<UUID> uids = new ArrayList<UUID>();
List<UUID> uids = new ArrayList<>();
@DbArray
List<Long> otherIds = new ArrayList<Long>();
List<Long> otherIds = new ArrayList<>();
@DbArray
List<Double> doubs;
@@ -29,7 +29,7 @@ public class TestDbArray_basic extends BaseTestCase {
phNumbers.add("9823");
List<Double> doubles = new ArrayList<Double>();
List<Double> doubles = new ArrayList<>();
doubles.add(1.3);
doubles.add(2.4);
@@ -140,7 +140,7 @@ public class TestDbArray_basic extends BaseTestCase {
bean.setOtherIds(null);
bean.setUids(null);
List<EArrayBean> all = new ArrayList<EArrayBean>();
List<EArrayBean> all = new ArrayList<>();
all.add(bean);
Ebean.saveAll(all);
@@ -56,7 +56,7 @@ public class Article extends BasicDomain {
public void addSection(Section s) {
if (sections == null) {
sections = new ArrayList<Section>();
sections = new ArrayList<>();
}
sections.add(s);
}
@@ -68,7 +68,7 @@ public class CKeyParent {
public void add(CKeyDetail detail) {
if (details == null) {
details = new ArrayList<CKeyDetail>();
details = new ArrayList<>();
}
details.add(detail);
}
@@ -42,7 +42,7 @@ public class Car extends Vehicle {
@OneToMany(mappedBy = "car")
@OrderBy("fuse.locationCode")
private Set<CarAccessory> accessories = new HashSet<CarAccessory>();
private Set<CarAccessory> accessories = new HashSet<>();
private String notes;
@@ -219,7 +219,7 @@ public class Customer extends BasicDomain {
public void addContact(Contact contact) {
if (contacts == null) {
contacts = new ArrayList<Contact>();
contacts = new ArrayList<>();
}
contacts.add(contact);
}
@@ -19,7 +19,7 @@ public class EVanillaCollection {
List<EVanillaCollectionDetail> details;
public EVanillaCollection() {
details = new ArrayList<EVanillaCollectionDetail>();
details = new ArrayList<>();
}
public Integer getId() {
@@ -64,7 +64,7 @@ public class MUser {
public void addRole(MRole role) {
if (roles == null) {
roles = new ArrayList<MRole>();
roles = new ArrayList<>();
}
roles.add(role);
}
@@ -67,7 +67,7 @@ public class MnocUser {
public void addValidRole(MnocRole role) {
if (validRoles == null) {
validRoles = new ArrayList<MnocRole>();
validRoles = new ArrayList<>();
}
validRoles.add(role);
}
@@ -30,7 +30,7 @@ public class MyEBasicConfigStartup implements ServerConfigStartup {
public static class EbasicBulkListener implements BulkTableEventListener {
final Set<String> s = new HashSet<String>();
final Set<String> s = new HashSet<>();
EbasicBulkListener() {
s.add("e_basic");
@@ -25,10 +25,10 @@ public class OCachedBean {
String name;
@ManyToMany(cascade = CascadeType.ALL)
List<Country> countries = new ArrayList<Country>();
List<Country> countries = new ArrayList<>();
@OneToMany(mappedBy = "cachedBean", cascade = CascadeType.ALL)
List<OCachedBeanChild> children = new ArrayList<OCachedBeanChild>();
List<OCachedBeanChild> children = new ArrayList<>();
public Long getId() {
return id;
@@ -252,7 +252,7 @@ public class Order implements Serializable {
public void addDetail(OrderDetail detail) {
if (details == null) {
details = new ArrayList<OrderDetail>();
details = new ArrayList<>();
}
details.add(detail);
}
@@ -268,7 +268,7 @@ public class Order implements Serializable {
public void addShipment(OrderShipment shipment) {
if (shipments == null) {
shipments = new ArrayList<OrderShipment>();
shipments = new ArrayList<>();
}
shipments.add(shipment);
}
@@ -257,7 +257,7 @@ public class ResetBasicData {
Order order = new Order();
order.setCustomer(customer);
List<OrderDetail> details = new ArrayList<OrderDetail>();
List<OrderDetail> details = new ArrayList<>();
details.add(new OrderDetail(product1, 5, 10.50));
details.add(new OrderDetail(product2, 3, 1.10));
details.add(new OrderDetail(product3, 1, 2.00));
@@ -278,7 +278,7 @@ public class ResetBasicData {
order.setStatus(Status.SHIPPED);
order.setCustomer(customer);
List<OrderDetail> details = new ArrayList<OrderDetail>();
List<OrderDetail> details = new ArrayList<>();
details.add(new OrderDetail(product1, 4, 10.50));
order.setDetails(details);
@@ -296,7 +296,7 @@ public class ResetBasicData {
order.setStatus(Status.COMPLETE);
order.setCustomer(customer);
List<OrderDetail> details = new ArrayList<OrderDetail>();
List<OrderDetail> details = new ArrayList<>();
details.add(new OrderDetail(product1, 3, 10.50));
details.add(new OrderDetail(product3, 40, 2.10));
details.add(new OrderDetail(product1, 5, 10.00));
@@ -73,7 +73,7 @@ public class Section extends BasicDomain {
public void addSubSection(SubSection s) {
if (subSections == null) {
subSections = new ArrayList<SubSection>();
subSections = new ArrayList<>();
}
subSections.add(s);
}
@@ -75,7 +75,7 @@ public class TSMaster {
public void addDetail(TSDetail detail) {
if (details == null) {
details = new ArrayList<TSDetail>();
details = new ArrayList<>();
}
details.add(detail);
}
@@ -72,7 +72,7 @@ public class TSMasterTwo {
public void addDetail(TSDetailTwo detail) {
if (details == null) {
details = new ArrayList<TSDetailTwo>();
details = new ArrayList<>();
}
details.add(detail);
}
@@ -78,7 +78,7 @@ public class UTMaster extends Model {
public void addDetail(UTDetail detail) {
if (details == null) {
details = new ArrayList<UTDetail>();
details = new ArrayList<>();
}
details.add(detail);
}
@@ -30,7 +30,7 @@ public class TestDeleteUnloadedChildren extends BaseTestCase {
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
ArrayList<EdChild> children = new ArrayList<>();
children.add(child);
parent.setChildren(children);
@@ -42,7 +42,7 @@ public class TestDeleteUnloadedChildren extends BaseTestCase {
child = new EdChild();
child.setName("DVBS Card");
children = new ArrayList<EdChild>();
children = new ArrayList<>();
children.add(child);
extendedParent.setChildren(children);
@@ -31,7 +31,7 @@ public class TestInsertBatchThenFlushThenUpdate extends BaseTestCase {
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
ArrayList<EdChild> children = new ArrayList<>();
children.add(child);
parent.setChildren(children);
@@ -33,7 +33,7 @@ public class TestInsertBatchThenUpdate extends BaseTestCase {
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
ArrayList<EdChild> children = new ArrayList<>();
children.add(child);
parent.setChildren(children);
@@ -30,7 +30,7 @@ public class TestInsertBatchWithDifferentRootTypes extends BaseTestCase {
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
ArrayList<EdChild> children = new ArrayList<>();
children.add(child);
parent.setChildren(children);
@@ -42,7 +42,7 @@ public class TestInsertBatchWithDifferentRootTypes extends BaseTestCase {
child = new EdChild();
child.setName("DVBS Card");
children = new ArrayList<EdChild>();
children = new ArrayList<>();
children.add(child);
extendedParent.setChildren(children);
@@ -10,7 +10,7 @@ import java.util.List;
@Entity
public class InfoCompany extends Model {
public static final Finder<Long,InfoCompany> find = new Finder<Long,InfoCompany>(InfoCompany.class);
public static final Finder<Long,InfoCompany> find = new Finder<>(InfoCompany.class);
@Id
Long id;
@@ -22,7 +22,7 @@ public class InfoCompany extends Model {
@JsonIgnore
@OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
List<InfoContact> contacts = new ArrayList<InfoContact>();
List<InfoContact> contacts = new ArrayList<>();
public Long getId() {
return id;
@@ -11,7 +11,7 @@ import javax.persistence.Version;
@Entity
public class InfoCustomer extends Model {
public static final Finder<Long,InfoCustomer> find = new Finder<Long,InfoCustomer>(InfoCustomer.class);
public static final Finder<Long,InfoCustomer> find = new Finder<>(InfoCustomer.class);
@Id
Long id;
@@ -31,15 +31,15 @@ public class Oid<T> {
}
public static Oid<?> valueOf(String s) {
return new Oid<Object>(Integer.valueOf(s));
return new Oid<>(Integer.valueOf(s));
}
public static Oid<?> valueOf(long i) {
return new Oid<Object>(i);
return new Oid<>(i);
}
public static <T> Oid<T> valueOf(Class<T> cls, String s) {
Integer v = Integer.valueOf(s);
return new Oid<T>(v);
return new Oid<>(v);
}
}
@@ -9,7 +9,7 @@ public class OidTypeConverter {//implements ScalarTypeConverter<Oid<?>,Long> {
if (scalarType == null){
return null;
}
return new Oid<Object>(scalarType);
return new Oid<>(scalarType);
}
public Long unwrapValue(Oid<?> beanType) {
@@ -25,7 +25,7 @@ public class EBasicHstore {
public EBasicHstore(String name) {
this.name = name;
this.map = new LinkedHashMap<String, String>();
this.map = new LinkedHashMap<>();
}
public Long getId() {
@@ -29,16 +29,16 @@ public class EBasicJsonList {
List<PlainBean> beanList;
@DbJson(length = 700)
Map<String,PlainBean> beanMap = new LinkedHashMap<String, PlainBean>();
Map<String,PlainBean> beanMap = new LinkedHashMap<>();
@DbJson(length = 500)
PlainBean plainBean;
@DbJson(length = 50)
Set<Long> flags = new LinkedHashSet<Long>();
Set<Long> flags = new LinkedHashSet<>();
@DbJson(length = 100, storage = DbJsonType.VARCHAR)
List<String> tags = new ArrayList<String>();
List<String> tags = new ArrayList<>();
@Version
Long version;
@@ -18,7 +18,7 @@ public class MpUser {
@OneToMany(cascade = CascadeType.ALL)
@MapKey(name = "code")
public Map<String, MpRole> roles = new HashMap<String, MpRole>();
public Map<String, MpRole> roles = new HashMap<>();
public Long getId() {
return id;
@@ -10,7 +10,7 @@ import javax.persistence.OneToOne;
@Entity
public class Album extends BaseModel {
public static final Model.Finder<Long, Album> find = new Model.Finder<Long, Album>(Album.class);
public static final Model.Finder<Long, Album> find = new Model.Finder<>(Album.class);
private String name;
@@ -15,7 +15,7 @@ public class Cover extends Model {
private static final Logger logger = LoggerFactory.getLogger(Cover.class);
public static final Finder<Long, Cover> find = new Finder<Long, Cover>(Cover.class);
public static final Finder<Long, Cover> find = new Finder<>(Cover.class);
@Id
protected Long id;
@@ -296,7 +296,7 @@ public class DeleteById_SoftDelete_Tests extends BaseTestCase {
}
private List<Long> ids(List<Cover> beans) {
List<Long> ids = new ArrayList<Long>();
List<Long> ids = new ArrayList<>();
for (Cover someBean : beans) {
ids.add(someBean.getId());
}
@@ -304,7 +304,7 @@ public class DeleteById_SoftDelete_Tests extends BaseTestCase {
}
private List<Cover> beans(int count) {
List<Cover> beans = new ArrayList<Cover>();
List<Cover> beans = new ArrayList<>();
for (int i = 0; i < count; i++) {
beans.add(new Cover("delById " + i));
}
@@ -26,7 +26,7 @@ public class ResourceFile extends BaseResourceFile {
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY, mappedBy = "parent")
@PrivateOwned
private Set<ResourceFile> alternatives = new HashSet<ResourceFile>();
private Set<ResourceFile> alternatives = new HashSet<>();
@Column(name = "name", length = 128, nullable = false)
private String name;
@@ -29,7 +29,7 @@ public class Group {
@OneToMany(mappedBy = "group", cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@OrderBy("sequenceNumber")
private List<Question> questions = new ArrayList<Question>();
private List<Question> questions = new ArrayList<>();
private int sequenceNumber;
@@ -16,25 +16,25 @@ public class TestOrderByFetch extends BaseTestCase {
public void test() {
Survey survey = new Survey("s1");
List<Category> categories = new ArrayList<Category>();
List<Category> categories = new ArrayList<>();
Category category = new Category("c1");
category.setSequenceNumber(1);
categories.add(category);
survey.setCategories(categories);
List<Group> groups = new ArrayList<Group>();
List<Group> groups = new ArrayList<>();
Group group1 = group(1);
Group group2 = group(2);
groups.add(group1);
groups.add(group2);
category.setGroups(groups);
List<Question> questionListGroup1 = new ArrayList<Question>();
List<Question> questionListGroup1 = new ArrayList<>();
questionListGroup1.add(question(1));
questionListGroup1.add(question(2));
questionListGroup1.add(question(3));
group1.setQuestions(questionListGroup1);
List<Question> questionListGroup2 = new ArrayList<Question>();
List<Question> questionListGroup2 = new ArrayList<>();
questionListGroup2.add(question(1));
questionListGroup2.add(question(2));
group2.setQuestions(questionListGroup2);
@@ -34,8 +34,8 @@ public class TestPersistenceContextScopeUsingOrders extends BaseTestCase {
assertTrue(!orders.isEmpty());
// collect the customer instances
List<Customer> customers = new ArrayList<Customer>();
Set<Integer> identities = new HashSet<Integer>();
List<Customer> customers = new ArrayList<>();
Set<Integer> identities = new HashSet<>();
for (Order order : orders) {
Customer customer = order.getCustomer();
@@ -24,7 +24,7 @@ public class TestSubQuery extends BaseTestCase {
ResetBasicData.reset();
List<Integer> productIds = new ArrayList<Integer>();
List<Integer> productIds = new ArrayList<>();
productIds.add(3);
Query<Order> sq = Ebean.createQuery(Order.class).select("id").where()
@@ -29,7 +29,7 @@ public class TestManyLazyLoadingQuery extends BaseTestCase {
BeanDescriptor<Order> descOrder = server.getBeanDescriptor(Order.class);
BeanPropertyAssocMany<?> beanProperty = (BeanPropertyAssocMany<?>)descOrder.getBeanProperty("details");
List<Object> parentIds = new ArrayList<Object>();
List<Object> parentIds = new ArrayList<>();
parentIds.add(1);
@@ -17,7 +17,7 @@ public class TestSoftDeletePagingList extends BaseTestCase {
@Test
public void test() {
List<Cover> list = new ArrayList<Cover>();
List<Cover> list = new ArrayList<>();
list.add(new Cover("SoftDelPaged-1"));
list.add(new Cover("SoftDelPaged-2"));
list.add(new Cover("SoftDelPaged-3"));
@@ -19,7 +19,7 @@ public class ParentQueryTest extends BaseTestCase {
@Test
public void QueryParentCollectionFetch() {
List<Data> exampleData = new ArrayList<Data>();
List<Data> exampleData = new ArrayList<>();
exampleData.add(new Data(0));
exampleData.add(new Data(1));
exampleData.add(new Data(2));
@@ -25,7 +25,7 @@ public class ParentRawSqlTest extends BaseTestCase {
@Test
public void RawSqlParentLoad() {
List<Data> exampleData = new ArrayList<Data>();
List<Data> exampleData = new ArrayList<>();
exampleData.add(new Data(0));
exampleData.add(new Data(1));
exampleData.add(new Data(2));
@@ -57,7 +57,7 @@ public class ParentRawSqlTest extends BaseTestCase {
@Test
public void RawSqlParentFetch() {
List<Data> exampleData = new ArrayList<Data>();
List<Data> exampleData = new ArrayList<>();
exampleData.add(new Data(0));
exampleData.add(new Data(1));
exampleData.add(new Data(2));
@@ -178,7 +178,7 @@ public class ParentRawSqlTest extends BaseTestCase {
.fetch("parent", new FetchConfig().query())
.findList();
List<Parent> partial = new ArrayList<Parent>();
List<Parent> partial = new ArrayList<>();
for (ParentAggregate aggregate : aggregates) {
partial.add(aggregate.parent);
}
@@ -202,7 +202,7 @@ public class ParentRawSqlTest extends BaseTestCase {
.fetch("parent", new FetchConfig().query())
.findList();
List<Parent> partial = new ArrayList<Parent>();
List<Parent> partial = new ArrayList<>();
for (ParentAggregate aggregate : aggregates) {
partial.add(aggregate.parent);
}
@@ -228,7 +228,7 @@ public class ParentRawSqlTest extends BaseTestCase {
.fetch("parent", new FetchConfig().query())
.findList();
List<Parent> partial = new ArrayList<Parent>();
List<Parent> partial = new ArrayList<>();
for (ParentAggregate aggregate : aggregates) {
partial.add(aggregate.parent);
}
@@ -359,9 +359,9 @@ public class TestReadAudit extends BaseTestCase {
class TDReadAuditLogger implements ReadAuditLogger {
Set<ReadAuditQueryPlan> plans = new HashSet<ReadAuditQueryPlan>();
List<ReadEvent> beans = new ArrayList<ReadEvent>();
List<ReadEvent> many = new ArrayList<ReadEvent>();
Set<ReadAuditQueryPlan> plans = new HashSet<>();
List<ReadEvent> beans = new ArrayList<>();
List<ReadEvent> many = new ArrayList<>();
TDReadAuditLogger(boolean dummy) {
}
@@ -43,7 +43,7 @@ public class TestSoftDeleteTop extends BaseTestCase {
transaction.end();
}
List<ESoftDelUp> list = new ArrayList<ESoftDelUp>();
List<ESoftDelUp> list = new ArrayList<>();
list.add(up1);
list.add(up2);
@@ -56,7 +56,7 @@ public class TestSoftDeleteTop extends BaseTestCase {
ESoftDelUp up1 = new ESoftDelUp("upBatchX");
ESoftDelUp up2 = new ESoftDelUp("upBatchY");
List<ESoftDelUp> list = new ArrayList<ESoftDelUp>();
List<ESoftDelUp> list = new ArrayList<>();
list.add(up1);
list.add(up2);
@@ -20,7 +20,7 @@ public class TestManyToManySaveTwice extends BaseTestCase {
Ebean.createSqlUpdate("delete from sp_car_wheel").execute();
Ebean.createSqlUpdate("delete from sp_car_car").execute();
List<Wheel> wheels = new LinkedList<Wheel>();
List<Wheel> wheels = new LinkedList<>();
wheels.add(new Wheel());
wheels.add(new Wheel());
wheels.add(new Wheel());
@@ -44,7 +44,7 @@ public class TestJsonSimple extends BaseTestCase {
Assert.assertEquals(12L, e2.get("a"));
Assert.assertEquals("rob", ((Map<String,Object>)e2.get("name")).get("first"));
Map<String, String> m = new LinkedHashMap<String, String>();
Map<String, String> m = new LinkedHashMap<>();
m.put("hello", "rob");
m.put("test", "me");
@@ -39,7 +39,7 @@ public class TestInsertManyAndRef extends BaseTestCase {
u.setName("Mr Test");
u.setPassword("password");
final List<BBookmark> bookmarks = new ArrayList<BBookmark>();
final List<BBookmark> bookmarks = new ArrayList<>();
final BBookmark b1 = new BBookmark();
b1.setBookmarkReference("Acts 2:7-20");
b1.setUser(u);
@@ -16,25 +16,25 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void testParsingOne() {
OrderBy<Object> o1 = new OrderBy<Object>("id");
OrderBy<Object> o1 = new OrderBy<>("id");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
assertTrue(o1.toStringFormat().equals("id"));
o1 = new OrderBy<Object>("id asc");
o1 = new OrderBy<>("id asc");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
assertTrue(o1.toStringFormat().equals("id"));
o1 = new OrderBy<Object>("id desc");
o1 = new OrderBy<>("id desc");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(!o1.getProperties().get(0).isAscending());
assertTrue(o1.toStringFormat().equals("id desc"));
o1 = new OrderBy<Object>(" id asc ");
o1 = new OrderBy<>(" id asc ");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
@@ -47,7 +47,7 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void parseNullsHigh() {
OrderBy<Object> o1 = new OrderBy<Object>("id desc nulls high");
OrderBy<Object> o1 = new OrderBy<>("id desc nulls high");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(!o1.getProperties().get(0).isAscending());
@@ -57,7 +57,7 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void add_parse() {
OrderBy<Object> o1 = new OrderBy<Object>();
OrderBy<Object> o1 = new OrderBy<>();
o1.add("id desc nulls high");
assertTrue(o1.getProperties().size() == 1);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
@@ -68,7 +68,7 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void parseNullsHigh_with_second() {
OrderBy<Object> o1 = new OrderBy<Object>("id desc nulls high, name");
OrderBy<Object> o1 = new OrderBy<>("id desc nulls high, name");
assertTrue(o1.getProperties().size() == 2);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(!o1.getProperties().get(0).isAscending());
@@ -80,7 +80,7 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void testParsingTwo() {
OrderBy<?> o1 = new OrderBy<Object>("id,name");
OrderBy<?> o1 = new OrderBy<>("id,name");
assertTrue(o1.getProperties().size() == 2);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
@@ -88,7 +88,7 @@ public class TestOrderByParse extends BaseTestCase {
assertTrue(o1.getProperties().get(1).isAscending());
assertEquals("id, name", o1.toStringFormat());
o1 = new OrderBy<Object>(" id , name ");
o1 = new OrderBy<>(" id , name ");
assertTrue(o1.getProperties().size() == 2);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
@@ -96,7 +96,7 @@ public class TestOrderByParse extends BaseTestCase {
assertTrue(o1.getProperties().get(1).isAscending());
assertEquals("id, name", o1.toStringFormat());
o1 = new OrderBy<Object>(" id desc , name desc ");
o1 = new OrderBy<>(" id desc , name desc ");
assertTrue(o1.getProperties().size() == 2);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(!o1.getProperties().get(0).isAscending());
@@ -104,7 +104,7 @@ public class TestOrderByParse extends BaseTestCase {
assertTrue(!o1.getProperties().get(1).isAscending());
assertEquals("id desc, name desc", o1.toStringFormat());
o1 = new OrderBy<Object>(" id ascending, name asc");
o1 = new OrderBy<>(" id ascending, name asc");
assertTrue(o1.getProperties().size() == 2);
assertTrue(o1.getProperties().get(0).getProperty().equals("id"));
assertTrue(o1.getProperties().get(0).isAscending());
@@ -117,7 +117,7 @@ public class TestOrderByParse extends BaseTestCase {
@Test
public void testAddMethods() {
OrderBy<?> o1 = new OrderBy<Object>();
OrderBy<?> o1 = new OrderBy<>();
o1.asc("id");
o1.asc("name");
assertTrue(o1.getProperties().size() == 2);
@@ -127,7 +127,7 @@ public class TestOrderByParse extends BaseTestCase {
assertTrue(o1.getProperties().get(1).isAscending());
assertEquals("id, name", o1.toStringFormat());
o1 = new OrderBy<Object>();
o1 = new OrderBy<>();
o1.desc("id");
o1.desc("name");
assertTrue(o1.getProperties().size() == 2);
@@ -136,7 +136,7 @@ public class TestStatelessUpdate extends BaseTestCase {
Customer customer = new Customer();
customer.setName("something");
customer.setContacts(new ArrayList<Contact>());
customer.setContacts(new ArrayList<>());
customer.getContacts().add(contact);
server.save(customer);
@@ -171,7 +171,7 @@ public class TestStatelessUpdate extends BaseTestCase {
Customer customer = new Customer();
customer.setName("something");
customer.setContacts(new ArrayList<Contact>());
customer.setContacts(new ArrayList<>());
customer.getContacts().add(contact);
server.save(customer);
@@ -204,7 +204,7 @@ public class TestStatelessUpdate extends BaseTestCase {
Customer customer = new Customer();
customer.setName("something");
customer.setContacts(new ArrayList<Contact>());
customer.setContacts(new ArrayList<>());
customer.getContacts().add(contact);
server.save(customer);
@@ -314,8 +314,8 @@ public class TestStatelessUpdate extends BaseTestCase {
Customer assCustomer = server.find(Customer.class, customer.getId());
List<Contact> assContacts = assCustomer.getContacts();
assertEquals(2, assContacts.size());
Set<Integer> ids = new LinkedHashSet<Integer>();
Set<String> names = new LinkedHashSet<String>();
Set<Integer> ids = new LinkedHashSet<>();
Set<String> names = new LinkedHashSet<>();
for (Contact contact : assContacts) {
ids.add(contact.getId());
names.add(contact.getLastName());
@@ -372,8 +372,8 @@ public class TestStatelessUpdate extends BaseTestCase {
// contact 2 was not deleted this time
assertEquals(3, assContacts.size());
Set<Integer> ids = new LinkedHashSet<Integer>();
Set<String> names = new LinkedHashSet<String>();
Set<Integer> ids = new LinkedHashSet<>();
Set<String> names = new LinkedHashSet<>();
for (Contact contact : assContacts) {
ids.add(contact.getId());
names.add(contact.getLastName());