net.corda.core.contracts

## Class DummyContractV2

- net.corda.core.contracts.DummyContractV2

- All Implemented Interfaces:
    Contract, UpgradedContract<OldState,NewState>

      public class DummyContractV2
      implements UpgradedContract<OldState,NewState>

  Dummy contract state for testing of the upgrade process.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DummyContractV2.State`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DummyContractV2()` Dummy contract state for testing of the upgrade process.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `kotlin.Pair<net.corda.core.transactions.WireTransaction,java.util.Set>` | `generateUpgradeFromV1(net.corda.core.contracts.StateAndRef states)` Generate an upgrade transaction from `class DummyContract`.
    `java.lang.Class<net.corda.core.contracts.DummyContract>` | `getLegacyContract()`
    `SecureHash` | `getLegalContractReference()` Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contract's contents).
    `DummyContractV2.State` | `upgrade(DummyContract.State state)` Upgrade contract's state object to a new state object.
    `void` | `verify(TransactionForContract tx)` Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if there's a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code.

    - ### Methods inherited from interface net.corda.core.contracts.UpgradedContract

      `getLegacyContract, upgrade`

    - ### Methods inherited from interface net.corda.core.contracts.Contract

      `getLegalContractReference, verify`

- - ### Constructor Detail

    - #### DummyContractV2

          public DummyContractV2()

      Dummy contract state for testing of the upgrade process.

  - ### Method Detail

    - #### getLegacyContract

          public java.lang.Class<net.corda.core.contracts.DummyContract> getLegacyContract()

    - #### upgrade

          public DummyContractV2.State upgrade(DummyContract.State state)

      Upgrade contract's state object to a new state object.

      Throws:
        - if the given state object is not one that can be upgraded. This can be either that the class is incompatible, or that the data inside the state object cannot be upgraded for some reason.

    - #### verify

          public void verify(TransactionForContract tx)

      Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if there's a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code.

    - #### getLegalContractReference

          public SecureHash getLegalContractReference()

      Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contract's contents).

    - #### generateUpgradeFromV1

          public kotlin.Pair<net.corda.core.transactions.WireTransaction,java.util.Set> generateUpgradeFromV1(net.corda.core.contracts.StateAndRef states)

      Generate an upgrade transaction from `class DummyContract`.

      Note: This is a convenience helper method used for testing only.

      Returns:
        a pair of wire transaction, and a set of those who should sign the transaction for it to be valid.
      See Also:
        `class DummyContract`