@Override public Result<Object> execute(String name, Object... args) { Set<Field> fields = getAllFields(context.getClass(), fieldPredicate(name)); if (!fields.isEmpty()) { Iterator<Field> iterator = fields.iterator(); while (iterator.hasNext()) { try { return new Result<Object>(iterator.next().get(context)); } catch (IllegalAccessException e) { // do nothing } } return new Result<Object>(); } else return new Result<Object>(); } };
@Override public Result<Object> execute(String name, Object... args) { Set<Field> fields = getAllFields(context.getClass(), fieldPredicate(name)); if (!fields.isEmpty()) { Iterator<Field> iterator = fields.iterator(); while (iterator.hasNext()) { try { return new Result<Object>(iterator.next().get(context)); } catch (IllegalAccessException e) { // do nothing } } return new Result<Object>(); } else return new Result<Object>(); } };
@Override public Result<Object> execute(final String name, Object... args) throws ExtractException { String[] prefixes = new String[]{ "get", "is", "has" }; Set<Method> methods = getAllMethods(context.getClass(), methodMatcher(equalToIgnoringCase(name), args.length)); int i = 0; while (methods.isEmpty() && i < prefixes.length) { methods = getAllMethods(context.getClass(), methodMatcher(equalToIgnoringCase(prefixes[i++] + name), args.length)); } if (methods.isEmpty()) return new Result<Object>(); else { Iterator<Method> iterator = methods.iterator(); while (iterator.hasNext()) { try { return new Result<Object>(iterator.next().invoke(context, args)); } catch (InvocationTargetException e) { throw new ExtractException(e); } catch (IllegalAccessException e) { // do nothing } } } return new Result<Object>(); } };
@Override public Result<Object> execute(final String name, Object... args) throws ExtractException { String[] prefixes = new String[]{ "get", "is", "has" }; Set<Method> methods = getAllMethods(context.getClass(), methodMatcher(equalToIgnoringCase(name), args.length)); int i = 0; while (methods.isEmpty() && i < prefixes.length) { methods = getAllMethods(context.getClass(), methodMatcher(equalToIgnoringCase(prefixes[i++] + name), args.length)); } if (methods.isEmpty()) return new Result<Object>(); else { Iterator<Method> iterator = methods.iterator(); while (iterator.hasNext()) { try { return new Result<Object>(iterator.next().invoke(context, args)); } catch (InvocationTargetException e) { throw new ExtractException(e); } catch (IllegalAccessException e) { // do nothing } } } return new Result<Object>(); } };
@Override public Result<Object> execute(String name, Object... args) throws ExtractException { return new Result<Object>(extractKnownType(name, args)); } };
@Override public Result<Object> execute(String name, Object... args) throws ExtractException { return new Result<Object>(extractKnownType(name, args)); } };