/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package web.component.impl.awselb.model;

import com.amazonaws.services.ec2.model.AvailabilityZone;
import web.component.api.model.Zone;

/**
 *
 * @author Hiroshi
 */
public class ZoneImpl extends AvailabilityZone implements Zone{
    
    private ZoneImpl(String name){
        super.setZoneName(name);
    }
    
    public static Zone create(String name){
        return new ZoneImpl(name);
    }
    
    @Override
    public String getName(){
        return super.getZoneName();
    }
    
    @Override
    public boolean equals(Object toBeCompared){
        if(toBeCompared instanceof ZoneImpl)
            return this.getName().equals(((ZoneImpl)toBeCompared).getName());
        return false;
    }
    
    @Override
    public void setZoneName(String zoneName){
        throw new UnsupportedOperationException("Zone name can not be modified.");
    }
    
    @Override
    public int hashCode(){
        //this is wrong, but don't know how to implement this method properly.
        return 31 * this.getName().hashCode();
    }

    @Override
    public String toString(){
        return "{ZoneName: " + getName() + "}";
    }
}

@@ -279,16 +279,64 @@
 tyZone;%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A
 import w
@@ -459,20 +459,16 @@
 s Zone%7B%0A
-    
 %0A    pri
@@ -476,104 +476,280 @@
 ate 
-ZoneImpl(String name)%7B%0A        super.setZoneName(name);%0A    %7D%0A    %0A    public static Zone create
+static final Map%3CString,Zone%3E existZones = new HashMap%3C%3E();%0A    %0A    public static Zone create(String name)%7B%0A        if(existZones.get(name) == null)%0A            existZones.put(name, new ZoneImpl(name));%0A        return existZones.get(name);%0A    %7D%0A    %0A    private ZoneImpl
 (Str
@@ -771,27 +771,25 @@
     
-return new ZoneImpl
+super.setZoneName
 (nam

Update ZoneImpl.java