/** Returns a clone with exactly the requested fields shallowly copied */
 @SuppressWarnings("unchecked")
 private static <T extends Persistent> T getPersistent(T obj, String[] fields) {
   if (Arrays.equals(fields, obj.getFields())) {
     return obj;
   }
   T newObj = (T) obj.newInstance(new StateManagerImpl());
   for (String field : fields) {
     int index = newObj.getFieldIndex(field);
     ((PersistentBase) newObj).put(index, ((PersistentBase) obj).get(index));
   }
   return newObj;
 }
Example #2
0
 static {
   PersistentBase.registerFields(ProtocolStatus.class, _ALL_FIELDS);
 }