1 package org.apache.maven.artifact; 2 3 18 19 import java.util.HashMap ; 20 import java.util.Map ; 21 22 28 public final class ArtifactStatus 29 implements Comparable 30 { 31 34 public static final ArtifactStatus NONE = new ArtifactStatus( "none", 0 ); 35 36 39 public static final ArtifactStatus GENERATED = new ArtifactStatus( "generated", 1 ); 40 41 44 public static final ArtifactStatus CONVERTED = new ArtifactStatus( "converted", 2 ); 45 46 49 public static final ArtifactStatus PARTNER = new ArtifactStatus( "partner", 3 ); 50 51 54 public static final ArtifactStatus DEPLOYED = new ArtifactStatus( "deployed", 4 ); 55 56 59 public static final ArtifactStatus VERIFIED = new ArtifactStatus( "verified", 5 ); 60 61 private final int rank; 62 63 private final String key; 64 65 private static Map map; 66 67 private ArtifactStatus( String key, int rank ) 68 { 69 this.rank = rank; 70 this.key = key; 71 72 if ( map == null ) 73 { 74 map = new HashMap (); 75 } 76 map.put( key, this ); 77 } 78 79 public static ArtifactStatus valueOf( String status ) 80 { 81 ArtifactStatus retVal = null; 82 83 if ( status != null ) 84 { 85 retVal = (ArtifactStatus) map.get( status ); 86 } 87 88 return retVal != null ? retVal : NONE; 89 } 90 91 public boolean equals( Object o ) 92 { 93 if ( this == o ) 94 { 95 return true; 96 } 97 if ( o == null || getClass() != o.getClass() ) 98 { 99 return false; 100 } 101 102 final ArtifactStatus that = (ArtifactStatus) o; 103 104 return rank == that.rank; 105 106 } 107 108 public int hashCode() 109 { 110 return rank; 111 } 112 113 public String toString() 114 { 115 return key; 116 } 117 118 public int compareTo( Object o ) 119 { 120 ArtifactStatus s = (ArtifactStatus) o; 121 return rank - s.rank; 122 } 123 } 124 | Popular Tags |