Interface FlowContextProperties

  • All Implemented Interfaces:

    
    public interface FlowContextProperties
    
                        

    Context properties of a Flow are key value pairs of Strings. They are comprised of two sets of properties, those set by the platform when a Flow is started, and those which are added by the CorDapp developer during the execution of their flow. The latter set are referred to as user context properties. All context properties are immutable once set.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void put(@NotNull() String key, @NotNull() String value) Puts a user value into the context property store.
      abstract String get(@NotNull() String key) Gets a value from the context property store.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • put

         abstract void put(@NotNull() String key, @NotNull() String value)

        Puts a user value into the context property store.

        Setting user properties with the same key as existing platform properties throws an IllegalArgumentException.

        It is highly advisable to scope user property keys with some unique prefix, e.g. package name. Corda's platform keys are usually prefixed with CORDA_RESERVED_PREFIX. This is reserved and an attempt to prefix a user key with CORDA_RESERVED_PREFIX also throws an IllegalArgumentException, whether the key exists already or not.

        Both sets of context properties are propagated automatically from the originating [Flow] to all sub-flows initiated flows, and services. Where sub-flows and initiated flows have extra user properties added, these are only visible in the scope of those flows and any of their sub-flows, initiated flows or services, but not back up the flow stack to any flows which launched or initiated those flows. The same is true of overwritten user properties. These properties are overwritten for the current flow and any flows initiated or instantiated by that flow, and also any further down the chain. When execution returns to a flow higher up the stack (a parent or one that initiated it) the overwritten properties are not visible.

        Parameters:
        key - The property key.
        value - The property value.
      • get

        @Nullable() abstract String get(@NotNull() String key)

        Gets a value from the context property store.

        Parameters:
        key - The property key.