Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jini.proxy
Class ConstrainableProxyUtil

    java.lang.Object
      com.sun.jini.proxy.ConstrainableProxyUtil

public class ConstrainableProxyUtil
extends Object

A collection of utility methods for use in implementing constrainable proxies. This class cannot be instantiated.

Since:
  2.0

Method Summary
`static boolean` | `equivalentConstraints(MethodConstraints methodConstraints1, MethodConstraints methodConstraints2, Method[] mappings)` Test to see if two `MethodConstraints` instances are equivalent given a method-to-method mapping.
`static MethodConstraints` | `translateConstraints(MethodConstraints methodConstraints, Method[] mappings)` Creates a `MethodConstraints` using the constraints in `methodConstraints`, but with the methods remapped according to `mappings`, where the first element of each pair of elements is mapped to the second.
`static void` | `verifyConsistentConstraints(MethodConstraints methodConstraints, Object proxy, Method[] mappings)` Verify that an object, `proxy`, is an instance of `RemoteMethodControl` its `MethodConstraints` are equivalent to another `MethodConstraints` instance, `methodConstraints` once a mapping has been applied.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### translateConstraints

    public static MethodConstraints translateConstraints(MethodConstraints methodConstraints,
                                                         Method[] mappings)

  Creates a `MethodConstraints` using the constraints in `methodConstraints`, but with the methods remapped according to `mappings`, where the first element of each pair of elements is mapped to the second. For example, if `methodConstraints` returns constraints `C1` for method `M1`, and the elements of mappings are methods `M1` and `M2`, then the resulting method constraints return `C1` for method `M2`.

  Parameters:
    `methodConstraints` - the method constraints whose methods should be translated, or `null` for empty constraints
    `mappings` - the method mappings
  Returns:
    the translated method constraints
  Throws:
    `NullPointerException` - if `mappings` is `null` or contains `null` elements
    `IllegalArgumentException` - if `mappings` contains an odd number of elements

### equivalentConstraints

    public static boolean equivalentConstraints(MethodConstraints methodConstraints1,
                                                MethodConstraints methodConstraints2,
                                                Method[] mappings)

  Test to see if two `MethodConstraints` instances are equivalent given a method-to-method mapping. Only the constraints for methods that appear in the mapping are compared. The mapping is represented by an array, `mappings`, of 2n `Method` objects. For all values p less than n the constraints associated with `mappings[2p]` in `methodConstraints1` are compared to the constraints associated with `mappings[2p+1]` in `methodConstraints2`. If null is passed in for both instances they are considered equivalent.

  Parameters:
    `methodConstraints1` - the first `MethodConstraints` object to compare.
    `methodConstraints2` - the second `MethodConstraints` object to compare.
    `mappings` - the method-to-method mapping.
  Returns:
    `true` if the `MethodConstraints` instances represent equivalent constraints, returns `false` otherwise.
  Throws:
    `NullPointerException` - if `mapping` is `null` contains `null` elements.
    `IllegalArgumentException` - if `mapping` contains an odd number of elements

### verifyConsistentConstraints

    public static void verifyConsistentConstraints(MethodConstraints methodConstraints,
                                                   Object proxy,
                                                   Method[] mappings)
                                            throws InvalidObjectException

  Verify that an object, `proxy`, is an instance of `RemoteMethodControl` its `MethodConstraints` are equivalent to another `MethodConstraints` instance, `methodConstraints` once a mapping has been applied. If `proxy` does not implement `RemoteMethodControl` or the associated constraints are not equivalent throw an `InvalidObjectException`. The mapping is represented by an array, `mappings`, of 2n `Method` objects. For all values p less than n the constraints associated with `mappings[2p]` in `methodConstraints` are compared to the constraints associated with `mappings[2p+1]` in the `MethodConstraints` returned by `proxy.getConstraints`. Will also return normally if both `methodConstraints` and the value returned by `proxy.getConstraints` are `null`.

  Parameters:
    `methodConstraints` - the method constraints `proxy` should have.
    `proxy` - the proxy to test, must implement `RemoteMethodControl`.
    `mappings` - the method to method mapping
  Throws:
    `NullPointerException` - if `mappings` or `proxy` is `null` or if `mapping` contains `null` elements
    `IllegalArgumentException` - if `mappings` contains an odd number of elements
    `InvalidObjectException` - if `proxy` does not implement `RemoteMethodControl`, or if the constraints on `proxy` are not equivalent to `methodConstraints`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved