1 11 12 13 package org.eclipse.jdt.apt.core.internal.util; 14 15 import java.io.IOException ; 16 import java.util.Map ; 17 18 23 public abstract class FactoryContainer 24 { 25 public enum FactoryType { 26 PLUGIN, EXTJAR, WKSPJAR, VARJAR; } 31 32 37 public abstract String getId(); 38 39 44 @Override 45 public String toString() { 46 return getId(); 47 } 48 49 public abstract FactoryType getType(); 50 51 62 public abstract boolean exists(); 63 64 69 protected abstract Map <String , String > loadFactoryNames() throws IOException ; 70 71 75 protected Map <String , String > _factoryNames; 76 77 public Map <String , String > getFactoryNames() throws IOException 78 { 79 if ( _factoryNames == null ) 80 _factoryNames = loadFactoryNames(); 81 return _factoryNames; 82 } 83 84 @Override 85 public int hashCode() { 86 return getType().hashCode() ^ getId().hashCode(); 87 } 88 89 @Override 90 public boolean equals(Object o) { 91 if (!(o instanceof FactoryContainer)) { 92 return false; 93 } 94 95 FactoryContainer other = (FactoryContainer) o; 96 return other.getType() == getType() && other.getId().equals(getId()); 97 } 98 } 99 100 | Popular Tags |