List of usage examples for org.hibernate.collection.internal PersistentList add
@Override
@SuppressWarnings("unchecked")
public boolean add(Object object)
From source file:com.erinors.hpb.server.handler.ListHandler.java
License:Apache License
@Override public Object clone(CloningContext context, Object object) { if (!(object instanceof List)) { return null; }//from w ww.j a v a 2 s . c om List<?> source = (List<?>) object; List<?> result; if (source instanceof PersistentList) { if (((PersistentList) source).wasInitialized()) { com.erinors.hpb.shared.impl.PersistentList<Object> list = new com.erinors.hpb.shared.impl.PersistentList<Object>( source.size()); context.addProcessedObject(object, list); for (Object element : source) { list.add(context.clone(element)); } list.setDirty(((PersistentCollection) source).isDirty()); result = list; } else { result = new UninitializedPersistentList<Object>(); context.addProcessedObject(object, result); } } else { List<Object> list = new ArrayList<Object>(source.size()); context.addProcessedObject(object, list); for (Object element : source) { list.add(context.clone(element)); } result = list; } return result; }
From source file:com.erinors.hpb.server.handler.ListHandler.java
License:Apache License
@Override public Object merge(MergingContext context, Object object) { if (!(object instanceof List)) { return null; }//from w ww .j a v a 2 s . com List<?> source = (List<?>) object; List<?> result; if (source instanceof UninitializedPersistentList) { result = new PersistentList(context.getSessionImplementor()); context.addProcessedObject(object, result); } else if (source instanceof com.erinors.hpb.shared.impl.PersistentList) { PersistentList list = new PersistentList(context.getSessionImplementor(), new ArrayList<Object>()); context.addProcessedObject(object, list); for (Object element : source) { list.add(context.merge(element)); } if (((com.erinors.hpb.shared.impl.PersistentList<?>) source).isDirty()) { list.dirty(); } else { list.clearDirty(); } result = list; } else { List<Object> list = new ArrayList<Object>(source.size()); context.addProcessedObject(object, list); for (Object element : source) { list.add(context.merge(element)); } result = list; } return result; }