public final class StringMethodConstraints extends Object implements MethodConstraints, Serializable
MethodConstraints
, allowing limited
wildcard matching on method names and parameter class name strings. Methods can be
specified by exact name and parameter class names (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. Normally instances of this class
should be obtained from a
Configuration
rather than being
explicitly constructed.
Canonical class name strings are used in place of class instances for
serialization compatiblity, to avoid ClassNotFoundExceptions or the
requirement to use codebase annotations, when classes don't exist.Modifier and Type | Class and Description |
---|---|
static class |
StringMethodConstraints.StringMethodDesc
Descriptor for specifying the constraints associated with one or
more methods allowing limited wildcard matching on method names and
parameter types.
|
Constructor and Description |
---|
StringMethodConstraints(AtomicSerial.GetArg arg)
Constructor for
AtomicSerial . |
StringMethodConstraints(BasicMethodConstraints constraints)
Creates a new StringMethodConstraints instance from BasicMethodConstraints.
|
StringMethodConstraints(InvocationConstraints constraints)
Creates an instance that maps all methods to the specified constraints.
|
StringMethodConstraints(StringMethodConstraints.StringMethodDesc[] descs)
Creates an instance with the specified ordered array of descriptors.
|
Modifier and Type | Method and Description |
---|---|
StringMethodConstraints |
combine(StringMethodConstraints constraints)
Creates a new BasicMethodConstraints instance that contains all constraints
in both this and the passed in constraints in an order that ensures
that preceeding method descriptors don't match all methods that later
descriptors do;
|
boolean |
equals(Object obj)
Two instances of this class are equal if they have the same descriptors
in the same order.
|
InvocationConstraints |
getConstraints(Method method)
Returns the constraints for the specified remote method as a
non-
null value. |
StringMethodConstraints.StringMethodDesc[] |
getMethodDescs()
Returns the descriptors.
|
int |
hashCode()
Returns a hash code value for this object.
|
Iterator<InvocationConstraints> |
possibleConstraints()
Returns an iterator that yields all of the possible distinct
constraints that can be returned by
getConstraints , in arbitrary order and with duplicates permitted. |
String |
toString()
Returns a string representation of this object.
|
public StringMethodConstraints(BasicMethodConstraints constraints)
constraints
- public StringMethodConstraints(StringMethodConstraints.StringMethodDesc[] descs)
getConstraints
method searches the
descriptors in the specified order. For any given descriptor in the
array, no preceding descriptor can match at least the same methods as
the given descriptor; that is, more specific descriptors must precede
less specific descriptors. The array passed to the constructor is
neither modified nor retained; subsequent changes to that array have
no effect on the instance created.descs
- the descriptorsNullPointerException
- if the argument is null
or
any element of the argument is null
IllegalArgumentException
- if the descriptors array is empty, or
if any descriptor is preceded by another descriptor that matches at
least the same methodspublic StringMethodConstraints(AtomicSerial.GetArg arg) throws IOException, ClassNotFoundException
AtomicSerial
.arg
- GetArg serial fieldsIOException
- if there are I/O errors while reading from GetArg's
underlying InputStream
InvalidObjectException
- if object invariants aren't satisfied.ClassNotFoundException
AtomicSerial
public StringMethodConstraints(InvocationConstraints constraints)
null
, which is treated the same as
an empty instance. Calling this constructor is equivalent to
constructing an instance of this class with an array containing a
single default descriptor constructed with the specified constraints.constraints
- the constraints, or null
public InvocationConstraints getConstraints(Method method)
null
value. Searches the descriptors in order, and
returns the constraints in the first descriptor that matches the
method, or an empty constraints instance if there is no match.getConstraints
in interface MethodConstraints
method
- the methodnull
valueNullPointerException
- if the argument is null
public Iterator<InvocationConstraints> possibleConstraints()
MethodConstraints
getConstraints
, in arbitrary order and with duplicates permitted. The
iterator throws an UnsupportedOperationException
on any
attempt to remove an element.possibleConstraints
in interface MethodConstraints
getConstraints
,
in arbitrary order and with duplicates permittedpublic StringMethodConstraints combine(StringMethodConstraints constraints)
constraints
- to be combined with this.public StringMethodConstraints.StringMethodDesc[] getMethodDescs()
null
array
every time it is called.null
arraypublic int hashCode()
public String toString()
Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.