Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2010. Axon Framework
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.axonframework.saga;
 
 
A combination of key and value by which a Saga can be found. Sagas are triggered by events that have a property that the saga is associated with. A single Association Value can lead to multiple Sagas, and a single Saga can be associated with multiple Association Values.

Two association values are considered equal when both their key and value are equal. For example, a Saga managing Orders could have a AssociationValue with key "orderId" and the order identifier as value.

Author(s):
Allard Buijze
Since:
0.7
 
 public class AssociationValue implements Serializable {
 
     private static final long serialVersionUID = 3573690125021875389L;
 
     private final String propertyKey;
     private final Object propertyValue;

    
Creates a Association Value instance with the given key and value.

Parameters:
key The key of the Association Value. Usually indicates where the value comes from.
value The value corresponding to the key of the association. It is highly recommended to only use serializable values.
 
     public AssociationValue(String keyObject value) {
         Assert.notNull(value"Cannot associate a Saga with a null value");
         this. = key;
         this. = value;
     }

    
Returns the key of this association value. The key usually indicates where the property's value comes from.

Returns:
the key of this association value
 
     public String getKey() {
         return ;
     }

    
Returns the value of this association.

Returns:
the value of this association. Never null.
 
     public Object getValue() {
         return ;
     }
 
     @SuppressWarnings({"RedundantIfStatement"})
     @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
         }
         if (o == null || getClass() != o.getClass()) {
             return false;
         }
 
         AssociationValue that = (AssociationValueo;
 
         if (!.equals(that.propertyKey)) {
             return false;
         }
         if (!.equals(that.propertyValue)) {
             return false;
         }
 
         return true;
     }
 
     @Override
     public int hashCode() {
         int result = .hashCode();
         result = 31 * result + .hashCode();
         return result;
     }
New to GrepCode? Check out our FAQ X