protected void makeDecrChange(String method, Object[] args) { String field = methodToField(method, 4); Attribute attr = _dao._allAttributes.get(field); assert (attr != null && attr.isUpdatable()) : "Updating an attribute that's not updatable: " + field; decr(attr, args == null || args.length == 0 ? 1 : args[0]); }
protected void makeIncrChange(String method, Object[] args) { String field = methodToField(method, 4); Attribute attr = _dao._allAttributes.get(field); assert (attr != null && attr.isUpdatable()) : "Updating an attribute that's not updatable: " + field; incr(attr, args == null || args.length == 0 ? 1 : args[0]); }
@Override public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { String name = method.getName(); if (name.startsWith("set")) { String field = methodToField(name, 3); makeChange(field, args[0]); } else if (name.startsWith("incr")) { makeIncrChange(name, args); } else if (name.startsWith("decr")) { makeDecrChange(name, args); } return methodProxy.invokeSuper(object, args); }
protected void makeDecrChange(final String method, final Object[] args) { final String field = methodToField(method, 4); final Attribute attr = _dao._allAttributes.get(field); assert (attr != null && attr.isUpdatable()) : "Updating an attribute that's not updatable: " + field; decr(attr, args == null || args.length == 0 ? 1 : args[0]); }
protected void makeIncrChange(final String method, final Object[] args) { final String field = methodToField(method, 4); final Attribute attr = _dao._allAttributes.get(field); assert (attr != null && attr.isUpdatable()) : "Updating an attribute that's not updatable: " + field; incr(attr, args == null || args.length == 0 ? 1 : args[0]); }
@Override public Object intercept(final Object object, final Method method, final Object[] args, final MethodProxy methodProxy) throws Throwable { final String name = method.getName(); if (name.startsWith("set")) { final String field = methodToField(name, 3); makeChange(field, args[0]); } else if (name.startsWith("incr")) { makeIncrChange(name, args); } else if (name.startsWith("decr")) { makeDecrChange(name, args); } return methodProxy.invokeSuper(object, args); }