1 19 20 package org.netbeans.modules.xml.schema.model; 21 22 import java.util.*; 23 24 28 public class SchemaComponentReference<T extends SchemaComponent> extends Object 29 { 30 34 private SchemaComponentReference(T component) 35 { 36 super(); 37 38 if (component==null) 39 { 40 throw new IllegalArgumentException ( 41 "Parameter \"component\" cannot be null"); 42 } 43 44 this.component=component; 45 } 46 47 48 52 public boolean equals(Object other) 53 { 54 if (!(other instanceof SchemaComponentReference)) 55 return false; 56 57 return this.get()==((SchemaComponentReference)other).get(); 58 } 59 60 61 65 public int hashCode() 66 { 67 return get().hashCode(); 71 } 72 73 74 78 public String toString() 79 { 80 return getClass().getName()+"<"+get().getClass().getName()+">"; 81 } 82 83 84 88 public T get() 89 { 90 return component; 91 } 92 93 94 98 public static <C extends SchemaComponent> 99 SchemaComponentReference<C> create(C component) 100 { 101 SchemaComponentReference<C> reference= 102 new SchemaComponentReference<C>(component); 103 104 return reference; 105 } 106 107 108 109 110 114 private T component; 115 } 116 | Popular Tags |