/** * Invokes given method with specified arguments. * * NOTE: implementation of current class has to process proxy method * parameters to get values of real method. * * @param instance target object * @param method method reference * @param params proxy method arguments * @return result of method invocation */ public Object invoke(Object instance, Method method, Object[] params) { Object[] args = getParameterValues(params); return ReflectionUtils.invoke(method, instance, args); } }
protected Object invokeReadMethod(Object target) { Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, null); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
protected void invokeWriteMethod(Object target, Object value) { try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[] { value }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
protected void invokeWriteMethod(Object target, Object value) { try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[]{value}); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
protected Object invokeReadMethod(Object target) { Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, null); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
protected Object invokeReadMethod(Object target) { Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, null); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
protected void invokeWriteMethod(Object target, Object value) { try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[] { value }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
MappingUtils.throwMappingException(e); Object returnObject = ReflectionUtils.invoke(method, factory, new Object[] {}); log.debug("createBean(Object, Class, String) - end [{}]", returnObject.getClass().getName()); result = returnObject;
public Object create(MappingParameters params, BeanCreationDirective directive) { Class<?> actualClass = directive.getActualClass(); String createMethod = directive.getCreateMethod(); Method method; if (createMethod.contains(".")) { String methodName = createMethod.substring(createMethod.lastIndexOf(".") + 1, createMethod.length()); String typeName = createMethod.substring(0, createMethod.lastIndexOf(".")); DozerClassLoader loader = BeanContainer.getInstance().getClassLoader(); Class<?> type = loader.loadClass(typeName); method = findMethod(type, methodName); } else { method = findMethod(actualClass, createMethod); } return ReflectionUtils.invoke(method, null, null); }
public Object create(MappingParameters params, BeanCreationDirective directive) { Class<?> actualClass = directive.getActualClass(); String createMethod = directive.getCreateMethod(); Method method; if (createMethod.contains(".")) { String methodName = createMethod.substring(createMethod.lastIndexOf(".") + 1, createMethod.length()); String typeName = createMethod.substring(0, createMethod.lastIndexOf(".")); DozerClassLoader loader = BeanContainer.getInstance().getClassLoader(); Class<?> type = loader.loadClass(typeName); method = findMethod(type, methodName); } else { method = findMethod(actualClass, createMethod); } return ReflectionUtils.invoke(method, null, null); }
@Override protected void invokeWriteMethod(Object target, Object value) { if (key == null) { throw new MappingException("key must be specified"); } try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[] { key, value }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
@Override protected void invokeWriteMethod(Object target, Object value) { if (key == null) { throw new MappingException("key must be specified"); } try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[]{key, value}); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
public Object create(BeanCreationDirective directive) { Class<?> actualClass = directive.getActualClass(); String createMethod = directive.getCreateMethod(); Method method; if (createMethod.contains(".")) { String methodName = createMethod.substring(createMethod.lastIndexOf(".") + 1, createMethod.length()); String typeName = createMethod.substring(0, createMethod.lastIndexOf(".")); DozerClassLoader loader = BeanContainer.getInstance().getClassLoader(); Class type = loader.loadClass(typeName); method = findMethod(type, methodName); } else { method = findMethod(actualClass, createMethod); } return ReflectionUtils.invoke(method, null, null); }
@Override protected void invokeWriteMethod(Object target, Object value) { if (key == null) { throw new MappingException("key must be specified"); } try { ReflectionUtils.invoke(getWriteMethod(), target, new Object[] { key, value }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } }
@Override protected Object invokeReadMethod(Object target) { if (key == null) { throw new MappingException("key must be specified"); } Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, new Object[] { key }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
@Override protected Object invokeReadMethod(Object target) { if (key == null) { throw new MappingException("key must be specified"); } Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, new Object[]{key}); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
@Override protected Object invokeReadMethod(Object target) { if (key == null) { throw new MappingException("key must be specified"); } Object result = null; try { result = ReflectionUtils.invoke(getReadMethod(), target, new Object[] { key }); } catch (NoSuchMethodException e) { MappingUtils.throwMappingException(e); } return result; }
private Object getDeepSrcFieldValue(Object srcObj) { // follow deep field hierarchy. If any values are null along the way, then return null Object parentObj = srcObj; Object hierarchyValue = parentObj; DeepHierarchyElement[] hierarchy = getDeepFieldHierarchy(srcObj, srcDeepIndexHintContainer); int size = hierarchy.length; for (int i = 0; i < size; i++) { DeepHierarchyElement hierarchyElement = hierarchy[i]; PropertyDescriptor pd = hierarchyElement.getPropDescriptor(); // If any fields in the deep hierarchy are indexed, get actual value within the collection at the specified index if (hierarchyElement.getIndex() > -1) { hierarchyValue = MappingUtils.getIndexedValue(ReflectionUtils.invoke(pd.getReadMethod(), hierarchyValue, null), hierarchyElement.getIndex()); } else { hierarchyValue = ReflectionUtils.invoke(pd.getReadMethod(), parentObj, null); } parentObj = hierarchyValue; if (hierarchyValue == null) { break; } } // If dest field is indexed, get actual value within the collection at the specified index if (isIndexed) { hierarchyValue = MappingUtils.getIndexedValue(hierarchyValue, index); } return hierarchyValue; }
MappingUtils.throwMappingException(e); result = ReflectionUtils.invoke(newInstanceMethod, null, emptyArglist); return result;
MappingUtils.throwMappingException(e); result = ReflectionUtils.invoke(newInstanceMethod, null, emptyArglist); return result;