1 8 14 package jfun.yan; 15 16 22 final class FailComponent extends Component { 23 private final String msg; 24 25 FailComponent(final String msg) { 26 this.msg = msg; 27 } 28 public Class getType() { 29 return null; 30 } 31 public boolean isConcrete(){ 32 return true; 33 } 34 public Object create(Dependency pp) 35 throws IrresolveableArgumentException, ParameterTypeMismatchException, 36 AmbiguousComponentResolutionException, ComponentInstantiationException, 37 YanException { 38 throw new ComponentResolutionException(msg); 39 } 40 41 public Class verify(Dependency pp) 42 throws IrresolveableArgumentException, ParameterTypeMismatchException, 43 AmbiguousComponentResolutionException, YanException { 44 throw new ComponentResolutionException(msg); 45 } 46 public String toString(){ 47 return "fail <" + msg + ">"; 48 } 49 50 public boolean equals(Object obj) { 51 if(obj instanceof FailComponent){ 52 final FailComponent other = (FailComponent)obj; 53 return Utils.eq(msg, other.msg); 54 } 55 else return false; 56 } 57 public int hashCode() { 58 return msg==null?0:msg.hashCode(); 59 } 60 public boolean isSingleton(){ 61 return false; 62 } 63 } 64 | Popular Tags |