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

## org.modeshape.graph.request
Class CompositeRequest

    java.lang.Object
      org.modeshape.graph.request.Request
          org.modeshape.graph.request.CompositeRequest

All Implemented Interfaces:
  Serializable, Iterable<Request>

Direct Known Subclasses:
  CompositeRequestChannel.ChannelCompositeRequest

    @Immutable
    public class CompositeRequest

extends Request
implements Iterable<Request>

A request that wraps multiple other requests, allowing multiple requests to be treated as a single request.

Note that `Request.isCancelled()` and `Request.cancel()` apply to all requests contained by the composite request. In other words, cancelling this request immediately marks all contained requests as cancelled. However, cancelling any request in the request has the effect of cancelling all other requests in the composite, including the composite. (This is implemented by having all `Request` objects in the composite share the same cancelled flag object.)

See Also:
  Serialized Form

Field Summary
`static int` | `UNKNOWN_NUMBER_OF_REQUESTS`

Constructor Summary
`protected` | `CompositeRequest(boolean readOnly)` Create a composite request from the supplied list of requests.
`protected` | `CompositeRequest(List<? extends Request> requests, boolean readOnly)` Create a composite request from the supplied list of requests.

Method Summary
`static CompositeRequest` | `add(CompositeRequest composite, Iterator<? extends Request> requests)` Add requests to the supplied composite request.
`static CompositeRequest` | `add(CompositeRequest composite, Request... requests)` Add requests to the supplied composite request.
`void` | `checkForErrors()` Check the set of requests for errors.
`boolean` | `equals(Object obj)`
`List<Request>` | `getRequests()` Return the unmodifiable requests contained in this composite request.
`RequestType` | `getType()` Returns the type of the request
`boolean` | `isReadOnly()` Return whether this request only reads information.
`Iterator<Request>` | `iterator()`
`int` | `size()` Get the number of requests.
`String` | `toString()`
`static Request` | `with(Iterator<? extends Request> requests)` Return a request that either wraps multiple requests, or the single request if only one is supplied.
`static Request` | `with(List<? extends Request> requests)` Return a request that either wraps multiple requests, or the single request if only one is supplied.
`static Request` | `with(Request... requests)` Return a request that either wraps multiple requests, or the single request if only one is supplied.

Methods inherited from class org.modeshape.graph.request.Request
`cancel, checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, printable, printable, setError, setLatchForFreezing`

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

Field Detail

### UNKNOWN_NUMBER_OF_REQUESTS

    public static final int UNKNOWN_NUMBER_OF_REQUESTS

See Also:
  Constant Field Values

Constructor Detail

### CompositeRequest

    protected CompositeRequest(List<? extends Request> requests,
                               boolean readOnly)

  Create a composite request from the supplied list of requests.

  Parameters:
    `requests` - the modifiable list of requests; may not be null
    `readOnly` - true if all of the requests are `read-only`

### CompositeRequest

    protected CompositeRequest(boolean readOnly)

  Create a composite request from the supplied list of requests. This is useful only for subclasses.

  Parameters:
    `readOnly` - true if all of the requests are `read-only`

Method Detail

### with

    public static Request with(Request... requests)

  Return a request that either wraps multiple requests, or the single request if only one is supplied.

  Parameters:
    `requests` - the requests to wrap
  Returns:
    the requests wrapped in a CompositeRequest, or if only one request is supplied that single request
  Throws:
    `IllegalArgumentException` - if there requests are null, empty, or contains only nulls

### with

    public static Request with(Iterator<? extends Request> requests)

  Return a request that either wraps multiple requests, or the single request if only one is supplied.

  Parameters:
    `requests` - the requests to wrap
  Returns:
    the requests wrapped in a CompositeRequest, or if only one request is supplied that single request
  Throws:
    `IllegalArgumentException` - if there requests are null, empty, or contains only nulls

### with

    public static Request with(List<? extends Request> requests)

  Return a request that either wraps multiple requests, or the single request if only one is supplied.

  Parameters:
    `requests` - the requests to wrap
  Returns:
    the requests wrapped in a CompositeRequest, or if only one request is supplied that single request
  Throws:
    `IllegalArgumentException` - if there requests are null or empty

### add

    public static CompositeRequest add(CompositeRequest composite,
                                       Request... requests)

  Add requests to the supplied composite request.

  Parameters:
    `composite` - the composite request to which the requests are to be added
    `requests` - the requests to wrap
  Returns:
    the requests wrapped in a CompositeRequest, or if only one request is supplied that single request, or null if there are no request
  Throws:
    `IllegalArgumentException` - if the composite request is null

### add

    public static CompositeRequest add(CompositeRequest composite,
                                       Iterator<? extends Request> requests)

  Add requests to the supplied composite request.

  Parameters:
    `composite` - the composite request to which the requests are to be added
    `requests` - the requests to wrap
  Returns:
    the requests wrapped in a CompositeRequest, or if only one request is supplied that single request, or null if there are no request
  Throws:
    `IllegalArgumentException` - if the composite request is null

### getRequests

    public List<Request> getRequests()

  Return the unmodifiable requests contained in this composite request.

  Returns:
    requests

### size

    public int size()

  Get the number of requests.

  Returns:
    the number of requests

### iterator

    public Iterator<Request> iterator()

  Specified by:
    `iterator` in interface `Iterable<Request>`
  See Also:
    `Iterable.iterator()`

### isReadOnly

    public boolean isReadOnly()

  Return whether this request only reads information.

  Specified by:
    `isReadOnly` in class `Request`
  Returns:
    true if this request reads information, or false if it requests that the repository content be changed in some way
  See Also:
    `Request.isReadOnly()`

### checkForErrors

    public void checkForErrors()

  Check the set of requests for errors. Calling this method will always result in the `existing error` being reset to a new error or null if there are no errors.

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getType

    public RequestType getType()

  Description copied from class: `Request`
  Returns the type of the request

  Specified by:
    `getType` in class `Request`
  Returns:
    the type of the request

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 © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.