1 16 package web.security.impl; 17 18 import java.io.Serializable ; 19 20 import web.security.Resource; 21 22 23 27 public class ResourceImpl implements Resource, Serializable { 28 29 protected String name; 30 protected String desc; 31 32 public ResourceImpl(){ 33 this(null,null); 34 } 35 36 public ResourceImpl(String name,String desc){ 37 this.name = name; 38 this.desc = desc; 39 } 40 41 public boolean equals(Resource res) { 42 boolean be = false; 43 if(name!=null && res!=null) 44 be = name.equals(res.getName()); 45 return be; 46 } 47 50 public String getName() { 51 return name; 52 } 53 54 57 public String getDesc() { 58 return desc; 59 } 60 61 public void setDesc(String desc) { 62 this.desc = desc; 63 } 64 public void setName(String name) { 65 this.name = name; 66 } 67 public String toString() { 68 return "RES["+getClass().getName()+"]:("+name+','+desc+')'; 69 } 70 71 public static void main(String [] args){ 72 ResourceImpl r1 = new ResourceImpl("log",null); 73 ResourceImpl r2 = new ResourceImpl("log",null); 74 System.out.println(r1.equals(r2)); 75 } 76 } 77 | Popular Tags |