org.tmatesoft.svn.core.wc2

## Class SvnReceivingOperation<T>

- java.lang.Object
- - org.tmatesoft.svn.core.wc2.SvnOperation<T>
  - - org.tmatesoft.svn.core.wc2.SvnReceivingOperation<T>

Type Parameters:
  `T` - type of received object(s)

All Implemented Interfaces:
  ISvnObjectReceiver<T>, ISvnOperationOptionsProvider

Direct Known Subclasses:
  AbstractSvnCommit, SvnAnnotate, SvnDiffSummarize, SvnGetChangelistPaths, SvnGetInfo, SvnGetProperties, SvnGetStatus, SvnList, SvnLog, SvnLogMergeInfo, SvnRepositoryFilter, SvnRepositoryInitialize, SvnRepositoryReceivingOperation, SvnRepositorySynchronize, SvnSetLock, SvnSetProperty, SvnUnlock

    public class SvnReceivingOperation<T>
    extends SvnOperation<T>
    implements ISvnObjectReceiver<T>

Represents base class for all operations that can fetch object(s) for custom processing.

Clients can provide their own handlers for receiving the object(s) by implementing `ISvnObjectReceiver` interface and assign it in `setReceiver(ISvnObjectReceiver)`.

Version:
  1.7
Author:
  TMate Software Ltd.
See Also:
  `SvnOperation`, `ISvnObjectReceiver`, `SvnAnnotate`, `SvnDiffSummarize`, `SvnGetChangelistPaths`, `SvnGetInfo`, `SvnGetProperties`, `SvnGetStatus`, `SvnList`, `SvnLog`, `SvnLogMergeInfo`, `SvnSetLock`, `SvnSetProperty`, `SvnUnlock`

### Constructor Summary

Constructors
`protected` `SvnReceivingOperation(SvnOperationFactory factory)`

### Method Summary

Methods
`T` `first()` Returns first received object from the list.
`ISvnObjectReceiver<T>` `getReceiver()` Returns client's object receiver.
`protected void` `initDefaults()`
`T` `last()` Returns last received object from the list.
`void` `receive(SvnTarget target, T object)` Receives the object, adds it to objects list and calls client's receiver if exists.
`java.util.Collection<T>` `run(java.util.Collection<T> objects)` Initializes list for received objects with `objects` or creates an empty list, calls the operation's `SvnOperation.run()` method.
`void` `setReceiver(ISvnObjectReceiver<T> receiver)` Sets client's object receiver.

### Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation

`addTarget, cancel, ensureArgumentsAreValid, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMaximumTargetsCount, getMinimumTargetsCount, getOperationalWorkingCopy, getOperationFactory, getOptions, getRepositoryPool, getRevision, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, isCancelled, isChangesWorkingCopy, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, run, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SvnReceivingOperation

    protected SvnReceivingOperation(SvnOperationFactory factory)

### Method Detail

#### setReceiver

    public void setReceiver(ISvnObjectReceiver<T> receiver)

Sets client's object receiver.

Parameters:
  `receiver` - object receiver

#### getReceiver

    public ISvnObjectReceiver<T> getReceiver()

Returns client's object receiver.

Returns:
  object receiver

#### receive

    public void receive(SvnTarget target,
               T object)
                 throws SVNException

Receives the object, adds it to objects list and calls client's receiver if exists.

Specified by:
  `receive` in interface `ISvnObjectReceiver<T>`
Parameters:
  `target` - target of the object
  `object` - object
Throws:
  `SVNException`

#### first

    public T first()

Returns first received object from the list.

Returns:
  first received object

#### last

    public T last()

Returns last received object from the list.

Returns:
  first received object

#### run

    public java.util.Collection<T> run(java.util.Collection<T> objects)
                                throws SVNException

Initializes list for received objects with `objects` or creates an empty list, calls the operation's `SvnOperation.run()` method.

Parameters:
  `objects` -
Returns:
  list of received objects
Throws:
  `SVNException`

#### initDefaults

    protected void initDefaults()

Overrides:
  `initDefaults` in class `SvnOperation<T>`