@Test(expected = IOException.class) public void check_PingUnserver() throws IOException { SmartRmiMarshaler marshaler = new SmartRmiMarshaler(); marshaler.detectRemoteInterfaces(PingUnserver.class); }
@SuppressWarnings({ "unchecked", "rawtypes" }) Class<?>[] detectRemoteInterfaces(Class<?> objClass) throws IOException { Class<?>[] result; List<Class<?>> iflist = new ArrayList<Class<?>>(); collect(iflist, objClass); Iterator<Class<?>> it = iflist.iterator(); while (it.hasNext()) { Class intf = it.next(); if (!isRemoteInterface(intf)) { it.remove(); continue; } for (Class other : new ArrayList<Class<?>>(iflist)) { if (intf != other && intf.isAssignableFrom(other)) { it.remove(); } } } if (iflist.isEmpty()) { for(Class intf: objClass.getInterfaces()) { if (!isRemoteInterface(intf)) { iflist.add(intf); } } reduceSuperTypes(iflist); } if (iflist.isEmpty()) { throw new IOException("Cannot calculate remote interface for class " + objClass.getName()); } result = iflist.toArray(new Class[iflist.size()]); return result; }
SmartRmiMarshaler implements RmiMarshaler { @SuppressWarnings({ "unchecked", "rawtypes" }) Class<?>[] detectRemoteInterfaces(Class<?> objClass) throws IOException { Class<?>[] result; List<Class<?>> iflist = new ArrayList<Class<?>>(); collect(iflist, objClass); Iterator<Class<?>> it = iflist.iterator(); while (it.hasNext()) { Class intf = it.next(); if (!isRemoteInterface(intf)) { it.remove(); continue; } for (Class other : new ArrayList<Class<?>>(iflist)) { if (intf != other && intf.isAssignableFrom(other)) { it.remove(); } } } if (iflist.isEmpty()) { for(Class intf: objClass.getInterfaces()) { if (!isRemoteInterface(intf)) { iflist.add(intf); } } reduceSuperTypes(iflist); } if (iflist.isEmpty()) { throw new IOException("Cannot calculate remote interface for class " + objClass.getName()); } result = iflist.toArray(new Class[iflist.size()]); return result; } }
SmartRmiMarshaler implements RmiMarshaler { @SuppressWarnings({ "unchecked", "rawtypes" }) Class<?>[] detectRemoteInterfaces(Class<?> objClass) throws IOException { Class<?>[] result; List<Class<?>> iflist = new ArrayList<Class<?>>(); collect(iflist, objClass); Iterator<Class<?>> it = iflist.iterator(); while (it.hasNext()) { Class intf = it.next(); if (!isRemoteInterface(intf)) { it.remove(); continue; } for (Class other : new ArrayList<Class<?>>(iflist)) { if (intf != other && intf.isAssignableFrom(other)) { it.remove(); } } } if (iflist.isEmpty()) { for(Class intf: objClass.getInterfaces()) { if (!isRemoteInterface(intf)) { iflist.add(intf); } } reduceSuperTypes(iflist); } if (iflist.isEmpty()) { throw new IOException("Cannot calculate remote interface for class " + objClass.getName()); } result = iflist.toArray(new Class[iflist.size()]); return result; } SmartRmiMarshaler();  SmartRmiMarshaler(Class<?>... types); }
SmartRmiMarshaler implements RmiMarshaler { @SuppressWarnings({ "unchecked", "rawtypes" }) Class<?>[] detectRemoteInterfaces(Class<?> objClass) throws IOException { Class<?>[] result; List<Class<?>> iflist = new ArrayList<Class<?>>(); collect(iflist, objClass); Iterator<Class<?>> it = iflist.iterator(); while (it.hasNext()) { Class intf = it.next(); if (!isRemoteInterface(intf)) { it.remove(); continue; } for (Class other : new ArrayList<Class<?>>(iflist)) { if (intf != other && intf.isAssignableFrom(other)) { it.remove(); } } } if (iflist.isEmpty()) { for(Class intf: objClass.getInterfaces()) { if (!isRemoteInterface(intf)) { iflist.add(intf); } } reduceSuperTypes(iflist); } if (iflist.isEmpty()) { throw new IOException("Cannot calculate remote interface for class " + objClass.getName()); } result = iflist.toArray(new Class[iflist.size()]); return result; } SmartRmiMarshaler();  SmartRmiMarshaler(Class<?>... types); @Override @SuppressWarnings("rawtypes") Object writeReplace(Object obj); @Override Object readResolve(Object obj); }
SmartRmiMarshaler implements RmiMarshaler { @SuppressWarnings({ "unchecked", "rawtypes" }) Class<?>[] detectRemoteInterfaces(Class<?> objClass) throws IOException { Class<?>[] result; List<Class<?>> iflist = new ArrayList<Class<?>>(); collect(iflist, objClass); Iterator<Class<?>> it = iflist.iterator(); while (it.hasNext()) { Class intf = it.next(); if (!isRemoteInterface(intf)) { it.remove(); continue; } for (Class other : new ArrayList<Class<?>>(iflist)) { if (intf != other && intf.isAssignableFrom(other)) { it.remove(); } } } if (iflist.isEmpty()) { for(Class intf: objClass.getInterfaces()) { if (!isRemoteInterface(intf)) { iflist.add(intf); } } reduceSuperTypes(iflist); } if (iflist.isEmpty()) { throw new IOException("Cannot calculate remote interface for class " + objClass.getName()); } result = iflist.toArray(new Class[iflist.size()]); return result; } SmartRmiMarshaler();  SmartRmiMarshaler(Class<?>... types); @Override @SuppressWarnings("rawtypes") Object writeReplace(Object obj); @Override Object readResolve(Object obj);  }