public static Object getObject(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet) {
- return new HashSet((Set)pc);
+ return new HashSet<>((Set<?>)pc);
}
if(pc instanceof PersistentSortedSet) {
- return new TreeSet((Set)pc);
+ return new TreeSet<>((Set<?>)pc);
}
if(pc instanceof PersistentList || pc instanceof PersistentBag) {
- return new ArrayList((List)pc);
+ return new ArrayList<>((List<?>)pc);
}
if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return new HashMap((Map)pc);
+ return new HashMap<>((Map<?,?>)pc);
}
if(pc instanceof PersistentSortedMap) {
- return new TreeMap((Map)pc);
+ return new TreeMap<>((Map<?,?>)pc);
}
throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
}
public static CollectionField getCollectionField(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet) {
- return new CollectionField(new HashSet((Set)pc), CollectionType.SET);
+ return new CollectionField(new HashSet<>((Set<?>)pc), CollectionType.SET);
}
if(pc instanceof PersistentSortedSet) {
- return new CollectionField(new TreeSet((Set)pc), CollectionType.SET);
+ return new CollectionField(new TreeSet<>((Set<?>)pc), CollectionType.SET);
}
if(pc instanceof PersistentList) {
- return new CollectionField(new ArrayList((List)pc), CollectionType.LIST);
+ return new CollectionField(new ArrayList<>((List<?>)pc), CollectionType.LIST);
}
if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return new CollectionField(new HashMap((Map)pc), CollectionType.MAP);
+ return new CollectionField(new HashMap<>((Map<?,?>)pc), CollectionType.MAP);
}
if(pc instanceof PersistentSortedMap) {
- return new CollectionField(new TreeMap((Map)pc), CollectionType.MAP);
+ return new CollectionField(new TreeMap<>((Map<?,?>)pc), CollectionType.MAP);
}
throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
}
return false;
}
- public static Object remoteLoadPersistentCollectionIfProxy(Object o, UUID ownerUuid, String fieldName) throws ClassNotFoundException {
+ @SuppressWarnings("unchecked")
+ public static Object remoteLoadPersistentCollectionIfProxy(Object o, UUID ownerUuid, String fieldName) throws ClassNotFoundException {
if(o != null && o instanceof HibernateProxy) {
LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
if(hli.isUninitialized()) {