public boolean supportsWriteObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "writeObject", new Class[]{ObjectOutputStream.class}, includeBaseClasses) != null; }
public boolean supportsReadObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "readObject", new Class[]{ObjectInputStream.class}, includeBaseClasses) != null; }
private Method getMethod(Class type, String name, Class[] parameterTypes, boolean includeBaseclasses) { Method method = getMethod(type, name, parameterTypes); return method == NO_METHOD || (!includeBaseclasses && !method.getDeclaringClass().equals(type)) ? null : method; }
private Method getRRMethod(final Class type, final String name) { final FastField method = new FastField(type, name); Method result = (Method)resRepCache.get(method); if (result == null) { result = getMethod(type, name, EMPTY_CLASSES, true); if (result != null && result.getDeclaringClass() != type) { if ((result.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0) { if ((result.getModifiers() & Modifier.PRIVATE) > 0 || type.getPackage() != result.getDeclaringClass().getPackage()) { result = NO_METHOD; } } } else if (result == null) { result = NO_METHOD; } resRepCache.put(method, result); } return result == NO_METHOD ? null : result; }
private Method getMethod(Class type, String name, Class[] parameterTypes) { if (type == null) { return null; } FastField method = new FastField(type, name); Method result = (Method)declaredCache.get(method); if (result == null) { try { result = type.getDeclaredMethod(name, parameterTypes); if (!result.isAccessible()) { result.setAccessible(true); } } catch (NoSuchMethodException e) { result = getMethod(type.getSuperclass(), name, parameterTypes); } declaredCache.put(method, result); } return result; }
public void callReadObject(final Class type, final Object object, final ObjectInputStream stream) { ErrorWritingException ex = null; try { Method readObjectMethod = getMethod( type, "readObject", new Class[]{ObjectInputStream.class}, false); readObjectMethod.invoke(object, new Object[]{stream}); } catch (IllegalAccessException e) { ex = new ObjectAccessException("Cannot access method", e); } catch (InvocationTargetException e) { ex = new ConversionException("Failed calling method", e.getTargetException()); } if (ex != null) { ex.add("method", object.getClass().getName() + ".readObject()"); throw ex; } }
public void callWriteObject(final Class type, final Object instance, final ObjectOutputStream stream) { ErrorWritingException ex = null; try { Method readObjectMethod = getMethod( type, "writeObject", new Class[]{ObjectOutputStream.class}, false); readObjectMethod.invoke(instance, new Object[]{stream}); } catch (IllegalAccessException e) { ex = new ObjectAccessException("Cannot access method", e); } catch (InvocationTargetException e) { ex = new ConversionException("Failed calling method", e.getTargetException()); } if (ex != null) { ex.add("method", instance.getClass().getName() + ".writeObject()"); throw ex; } }
public boolean supportsReadObject(final Class<?> type, final boolean includeBaseClasses) { return getMethod(type, "readObject", includeBaseClasses, ObjectInputStream.class) != null; }
public boolean supportsReadObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "readObject", new Class[]{ObjectInputStream.class}, includeBaseClasses) != null; }
public boolean supportsWriteObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "writeObject", new Class[]{ObjectOutputStream.class}, includeBaseClasses) != null; }
public boolean supportsWriteObject(final Class<?> type, final boolean includeBaseClasses) { return getMethod(type, "writeObject", includeBaseClasses, ObjectOutputStream.class) != null; }
public boolean supportsReadObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "readObject", new Class[]{ObjectInputStream.class}, includeBaseClasses) != null; }
public boolean supportsWriteObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "writeObject", new Class[]{ObjectOutputStream.class}, includeBaseClasses) != null; }
public boolean supportsWriteObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "writeObject", new Class[]{ObjectOutputStream.class}, includeBaseClasses) != null; }
public boolean supportsReadObject(final Class type, final boolean includeBaseClasses) { return getMethod( type, "readObject", new Class[]{ObjectInputStream.class}, includeBaseClasses) != null; }
private Method getMethod(final Class<?> type, final String name, final boolean includeBaseclasses, final Class<?>... parameterTypes) { final Method method = getMethod(type, name, parameterTypes); return method == NO_METHOD || !includeBaseclasses && !method.getDeclaringClass().equals(type) ? null : method; }
private Method getMethod(Class type, String name, Class[] parameterTypes, boolean includeBaseclasses) { Method method = getMethod(type, name, parameterTypes); return method == NO_METHOD || (!includeBaseclasses && !method.getDeclaringClass().equals(type)) ? null : method; }
private Method getMethod(Class type, String name, Class[] parameterTypes, boolean includeBaseclasses) { Method method = getMethod(type, name, parameterTypes); return method == NO_METHOD || (!includeBaseclasses && !method.getDeclaringClass().equals(type)) ? null : method; }
private Method getMethod(Class type, String name, Class[] parameterTypes, boolean includeBaseclasses) { Method method = getMethod(type, name, parameterTypes); return method == NO_METHOD || (!includeBaseclasses && !method.getDeclaringClass().equals(type)) ? null : method; }
public void callReadObject(final Class<?> type, final Object object, final ObjectInputStream stream) { ErrorWritingException ex = null; try { final Method readObjectMethod = getMethod(type, "readObject", false, ObjectInputStream.class); readObjectMethod.invoke(object, stream); } catch (final IllegalAccessException e) { ex = new ObjectAccessException("Cannot access method", e); } catch (final InvocationTargetException e) { ex = new ConversionException("Failed calling method", e.getTargetException()); } if (ex != null) { ex.add("method", object.getClass().getName() + ".readObject()"); throw ex; } }