@@ -0,0 +1,2813 @@
+/*%0A * Copyright (c) 2013 Red Rainbow IT Solutions GmbH, Germany%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy of%0A * this software and associated documentation files (the %22Software%22), to deal in%0A * the Software without restriction, including without limitation the rights to%0A * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of%0A * the Software, and to permit persons to whom the Software is furnished to do so,%0A * subject to the following conditions:%0A * %0A * The above copyright notice and this permission notice shall be included in all%0A * copies or substantial portions of the Software.%0A * %0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS%0A * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR%0A * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER%0A * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN%0A * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A */%0A%0Apackage org.jeecqrs.common;%0A%0Aimport org.jeecqrs.common.util.Validate;%0Aimport org.jeecqrs.common.domain.model.ValueObject;%0Aimport java.util.UUID;%0A%0A/**%0A * A layer supertype for ID value objects.%0A * This class is mainly here to follow the DRY-principle:%0A * All ID value objects require an id-string that uniquely define%0A * the aggregate, and any two ids of the same type are considered%0A * equals if their idString is equal.%0A */%0Apublic abstract class AbstractId%3CT%3E implements ValueObject%3CT%3E, Identity %7B%0A%0A    private String id;%0A%0A    /**%0A     * The default constructor creates a random id.%0A     */%0A    public AbstractId() %7B%0A        this(UUID.randomUUID().toString().toUpperCase());%0A    %7D%0A%0A    /**%0A     * Create a new %7B@code AbstractId%7D from a %7B@code String%7D representation.%0A     * %0A     * @param idString  the string representation%0A     */%0A    public AbstractId(String idString) %7B%0A%09Validate.notNull(idString, %22idString must not be null%22);%0A%09this.id = idString;%0A    %7D%0A%0A    @Override%0A    public String idString() %7B%0A%09return id;%0A    %7D%0A%0A    @Override%0A    public final boolean sameValueAs(T other) %7B%0A        if (other == null %7C%7C !this.getClass().equals(other.getClass()))%0A            return false;%0A        AbstractId%3CT%3E o = (AbstractId%3CT%3E) other;%0A        return this.idString().equals(o.idString());%0A    %7D%0A%0A    @Override%0A    public final boolean equals(Object o) %7B%0A%09if (this == o)%0A%09    return true;%0A%09if (o == null %7C%7C getClass() != o.getClass())%0A%09    return false;%0A        T other = (T) o;%0A%09return sameValueAs(other);%0A    %7D%0A%0A    @Override%0A    public final int hashCode() %7B%0A%09return id.hashCode();%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return idString();%0A    %7D%0A%0A%7D%0A

Add AbstractId