check(); } catch (RuntimeException e) { rethrow(e);
check(name, types); } catch (RuntimeException e) { rethrow(e);
/** * Creates a descriptor that only matches methods with exactly the specified name and * parameter types. The constraints can be <code>null</code>, which is treated the same as * an empty instance. The array passed to the constructor is neither modified nor retained; * subsequent changes to that array have no effect on the instance created. * * @param name the name of the method * @param types the formal parameter types of the method, in declared order * @param constraints the constraints, or <code>null</code> * @throws NullPointerException if <code>name</code> or <code>types</code> is * <code>null</code> or any element of <code>types</code> * is <code>null</code> * @throws IllegalArgumentException if <code>name</code> is not a syntactically valid method * name */ public MethodDesc(String name, Class[] types, InvocationConstraints constraints) { this.name = name; this.types = types.clone(); if (constraints != null && constraints.isEmpty()) { constraints = null; } this.constraints = constraints; check(); }
/** * Creates a descriptor that matches all methods with names that * equal the specified name or that match the specified pattern, * regardless of their parameter types. If the specified name starts * with the character '*', then this descriptor matches all methods * with names that end with the rest of the specified name. If the * specified name ends with the character '*', then this descriptor * matches all methods with names that start with the rest of the * specified name. Otherwise, this descriptor matches all methods * with names that equal the specified name. The constraints can be * <code>null</code>, which is treated the same as an empty instance. * * @param name the name of the method, with a prefix or suffix '*' * permitted for pattern matching * @param constraints the constraints, or <code>null</code> * @throws NullPointerException if <code>name</code> is * <code>null</code> * @throws IllegalArgumentException if <code>name</code> does not * match any syntactically valid method name */ public MethodDesc(String name, InvocationConstraints constraints) { this(check(name, null), name, null, constraints ); }
/** * Creates a descriptor that only matches methods with exactly the * specified name and parameter types. The constraints can be * <code>null</code>, which is treated the same as an empty * instance. The array passed to the constructor is neither modified * nor retained; subsequent changes to that array have no effect on * the instance created. * * @param name the name of the method * @param types the formal parameter types of the method, in declared * order * @param constraints the constraints, or <code>null</code> * @throws NullPointerException if <code>name</code> or * <code>types</code> is <code>null</code> or any element of * <code>types</code> is <code>null</code> * @throws IllegalArgumentException if <code>name</code> is not a * syntactically valid method name */ public MethodDesc(String name, Class[] types, InvocationConstraints constraints) { this(check(name, types), name, types, constraints ); }
/** * Creates a descriptor that matches all methods with names that equal the specified name or * that match the specified pattern, regardless of their parameter types. If the specified * name starts with the character '*', then this descriptor matches all methods with names * that end with the rest of the specified name. If the specified name ends with the * character '*', then this descriptor matches all methods with names that start with the * rest of the specified name. Otherwise, this descriptor matches all methods with names * that equal the specified name. The constraints can be <code>null</code>, which is treated * the same as an empty instance. * * @param name the name of the method, with a prefix or suffix '*' permitted for * pattern matching * @param constraints the constraints, or <code>null</code> * @throws NullPointerException if <code>name</code> is <code>null</code> * @throws IllegalArgumentException if <code>name</code> does not match any syntactically * valid method name */ public MethodDesc(String name, InvocationConstraints constraints) { this.name = name; this.types = null; if (constraints != null && constraints.isEmpty()) { constraints = null; } this.constraints = constraints; check(); }