Package net.jini.constraint
Class BasicMethodConstraints.MethodDesc
java.lang.Object
net.jini.constraint.BasicMethodConstraints.MethodDesc
- All Implemented Interfaces:
Serializable
- Enclosing class:
- BasicMethodConstraints
Descriptor for specifying the constraints associated with one or more methods allowing
limited wildcard matching on method names and parameter types. Methods can be specified by
exact name and parameter types (matching a single method), by exact name (matching all
methods with that name), by name prefix (matching all methods with names that start with that
prefix), by name suffix (matching all methods with names that end with that suffix), and by a
default that matches all methods.
- Since:
- 2.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMethodDesc(String name, Class[] types, InvocationConstraints constraints) Creates a descriptor that only matches methods with exactly the specified name and parameter types.MethodDesc(String name, InvocationConstraints 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.MethodDesc(InvocationConstraints constraints) Creates a default descriptor that matches all methods. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo instances of this class are equal if they have the same name, the same parameter types, and the same constraints.Returns the constraints as a non-nullvalue.getName()Returns the name of the method, with a prefix or suffix '*' if the name is a pattern, ornullif this descriptor matches all methods.Class[]Returns the parameter types, ornullif this descriptor matches all parameter types or all methods.inthashCode()Returns a hash code value for this object.toString()Returns a string representation of this object.
-
Constructor Details
-
MethodDesc
Creates a descriptor that only matches methods with exactly the specified name and parameter types. The constraints can benull, 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.- Parameters:
name- the name of the methodtypes- the formal parameter types of the method, in declared orderconstraints- the constraints, ornull- Throws:
NullPointerException- ifnameortypesisnullor any element oftypesisnullIllegalArgumentException- ifnameis not a syntactically valid method name
-
MethodDesc
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 benull, which is treated the same as an empty instance.- Parameters:
name- the name of the method, with a prefix or suffix '*' permitted for pattern matchingconstraints- the constraints, ornull- Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnamedoes not match any syntactically valid method name
-
MethodDesc
Creates a default descriptor that matches all methods. The constraints can benull, which is treated the same as an empty instance.- Parameters:
constraints- the constraints, ornull
-
-
Method Details
-
getName
Returns the name of the method, with a prefix or suffix '*' if the name is a pattern, ornullif this descriptor matches all methods.- Returns:
- the name of the method, with a prefix or suffix '*' if the name is a pattern, or
nullif this descriptor matches all methods
-
getParameterTypes
Returns the parameter types, ornullif this descriptor matches all parameter types or all methods. Returns a new non-nullarray every time it is called.- Returns:
- the parameter types, or
nullif this descriptor matches all parameter types or all methods
-
getConstraints
Returns the constraints as a non-nullvalue.- Returns:
- the constraints as a non-
nullvalue
-
hashCode
public int hashCode()Returns a hash code value for this object. -
equals
Two instances of this class are equal if they have the same name, the same parameter types, and the same constraints. -
toString
Returns a string representation of this object.
-