/** * Inserts total number of method's arguments. */ public static int argumentsCount() { throw new ProxettaException(); }
/** * Creates array of arguments values. It is more safely then to get one argument at time, since * the returned array has correct length. * Equals to: <code>new Object[] {arg1, arg2,...}</code> * @see #createArgumentsClassArray() * @see #argument(int) */ public static Object[] createArgumentsArray() { throw new ProxettaException(); }
/** * Inserts targets class annotation value. Inserts <code>null</code> * if annotation or element is missing. */ public static Object targetClassAnnotation(final String annotationClassName, final String element) { throw new ProxettaException(); }
/** * Inserts populated {@link jodd.proxetta.ProxyTargetInfo} instance. */ public static ProxyTargetInfo info() { throw new ProxettaException(); }
/** * Checks if target is not defined yet. */ private void assertTargetIsNotDefined() { if (targetInputStream != null) { throw new ProxettaException("Target already defined"); } }
/** * Inserts target class. */ public static Class targetClass() { throw new ProxettaException(); }
/** * Inserts target method name. Useful for reflection. */ public static String targetMethodName() { throw new ProxettaException(); }
/** * Assigns new value for an argument specified by 1-based index. */ public static void setArgument(final Object value, final int index) { throw new ProxettaException(); }
/** * Inserts proxy (i.e. target) instance. */ public static Object target() { throw new ProxettaException(); }
/** * Inserts target method signature, java alike, including the method name. * Useful for identifying the method, since it is unique for class. * @see #targetMethodDescription() */ public static String targetMethodSignature() { throw new ProxettaException(); }
/** * Inserts targets method annotation value. Inserts <code>null</code> * if annotation or element is missing. */ public static Object targetMethodAnnotation(final String annotationClassName, final String element) { throw new ProxettaException(); } /**
/** * Creates array of arguments types. Works correctly with <code>null</code> argument values. * Equals to: <code>new Class[] {Arg1Type.class, Arg2Type.class...}</code> * @see #createArgumentsArray() * @see #argumentType(int) */ public static Class[] createArgumentsClassArray() { throw new ProxettaException(); }
/** * Inserts return type of target method. <code>null</code> is used for void. */ public static Class returnType() { throw new ProxettaException(); }
/** * Inserts target method description, bytecode alike, <b>without</b> method name. * May be used for identifying the method. * @see #targetMethodSignature() */ public static String targetMethodDescription() { throw new ProxettaException(); }
/** * Checks if proxy is created and throws an exception if not. */ protected void assertProxyIsCreated() { if (destClassWriter == null) { throw new ProxettaException("Target not accepted yet!"); } }
/** * Defines the interface of the resulting class. */ public WrapperProxettaFactory setTargetInterface(final Class targetInterface) { if (!targetInterface.isInterface()) { throw new ProxettaException("Not an interface: " + targetInterface.getName()); } this.targetInterface = targetInterface; return this; }
/** * Returns wrapper target type. */ public static Class getTargetWrapperType(final Class wrapperClass) { try { final Field field = wrapperClass.getDeclaredField(ProxettaNames.wrapperTargetFieldName); return field.getType(); } catch (NoSuchFieldException nsfex) { throw new ProxettaException(nsfex); } }
/** * Prevents advice to have inner classes. */ @Override public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) { if (outerName.equals(adviceReference)) { throw new ProxettaException("Proxetta doesn't allow inner classes in/for advice: " + advice.getName()); } super.visitInnerClass(name, outerName, innerName, access); }
/** * Validates argument index. */ public static void checkArgumentIndex(final MethodInfo methodInfo, final int argIndex) { if ((argIndex < 1) || (argIndex > methodInfo.getArgumentsCount())) { throw new ProxettaException("Invalid argument index: " + argIndex); } }
/** * Creates new instance of created class. * Assumes default no-arg constructor. */ public Object newInstance() { Class type = define(); try { return ClassUtil.newInstance(type); } catch (Exception ex) { throw new ProxettaException("Invalid Proxetta class", ex); } }