Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2011. 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
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.axonframework.domain;

Abstract implementation of the aggregate identifier providing basic functionality as defined by AggregateIdentifier.

This implementation contains an implementation of the compareTo(org.axonframework.domain.AggregateIdentifier), equals(java.lang.Object), hashCode() and toString() methods.

The compareTo(org.axonframework.domain.AggregateIdentifier) methods returns the result of the comparison of both identifier's string representations. For numerical values, this may not be a suitable comparison. For example, 3 would be evaluated as being larger than 10, when compared as Strings.

Allard Buijze
    private static final long serialVersionUID = -4777291695127713605L;


This implementation returns the result of AggregateIdentifier.asString().

    public String toString() {
        return asString();


This implementation returns the hashCode of the string representation of the identifier.

    public int hashCode() {
        return asString().hashCode();


This implementation compared the string representations of both identifiers.

    public int compareTo(AggregateIdentifier other) {
        return asString().compareTo(other.asString());
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        if (!(o instanceof AggregateIdentifier)) {
            return false;
        AggregateIdentifier that = (AggregateIdentifiero;
        return asString().equals(that.asString());
New to GrepCode? Check out our FAQ X