private void addImpl(Object cookie) { synchronized (this) { registerCookie(cookie.getClass(), cookie); } if (ic != null) { ic.add(cookie); } }
/** Attaches cookie to given class and all its superclasses and * superinterfaces. * * @param c class or null * @param cookie cookie to attach */ private void registerCookie(Class<?> c, Object cookie) { if ((c == null) || !Node.Cookie.class.isAssignableFrom(c)) { return; } Class<? extends Node.Cookie> nc = c.asSubclass(Node.Cookie.class); R r = findR(nc); if (r == null) { r = new R(); map.put(c, r); } r.add((Node.Cookie)cookie); registerCookie(c.getSuperclass(), cookie); Class[] inter = c.getInterfaces(); for (int i = 0; i < inter.length; i++) { registerCookie(inter[i], cookie); } }
/** Registers a Factory for given cookie class */ public void add(Class<? extends Node.Cookie> cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } final CookieEntry ce = new CookieEntry(factory, cookieClass); synchronized (this) { registerCookie(cookieClass, ce); } if (ic != null) { ic.add(ce, C.INSTANCE); } fireChangeEvent(); }
/** Registers a Factory for given cookie classes */ public void add(Class<? extends Node.Cookie>[] cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } CookieEntry[] arr = new CookieEntry[cookieClass.length]; synchronized (this) { for (int i = 0; i < cookieClass.length; i++) { registerCookie(cookieClass[i], arr[i] = new CookieEntry(factory, cookieClass[i])); } } if (ic != null) { int i = 0; for (Class<? extends Node.Cookie> c : cookieClass) { ic.add(arr[i++], C.INSTANCE); } } fireChangeEvent(); }
synchronized (this) { for (T t : instances) { registerCookie(t.getClass(), t);
/** Add a new cookie to the set. If a cookie of the same * <em>actual</em> (not representation!) class is already there, * it is replaced. * <p>Cookies inserted earlier are given preference during lookup, * in case a supplied representation class matches more than one cookie * in the set. * * @param cookie cookie to add */ public void add (Node.Cookie cookie) { synchronized (this) { registerCookie (cookie.getClass (), cookie); } fireChangeEvent (); }
/** Add a new cookie to the set. If a cookie of the same * <em>actual</em> (not representation!) class is already there, * it is replaced. * <p>Cookies inserted earlier are given preference during lookup, * in case a supplied representation class matches more than one cookie * in the set. * * @param cookie cookie to add */ public void add (Node.Cookie cookie) { synchronized (this) { registerCookie (cookie.getClass (), cookie); } fireChangeEvent (); }
/** Registers a Factory for given cookie classes */ public void add(Class[] cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } synchronized (this) { for (int i = 0; i < cookieClass.length; i++) { registerCookie (cookieClass[i], new CookieEntry(factory, cookieClass[i])); } } fireChangeEvent (); }
/** Registers a Factory for given cookie classes */ public void add(Class[] cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } synchronized (this) { for (int i = 0; i < cookieClass.length; i++) { registerCookie (cookieClass[i], new CookieEntry(factory, cookieClass[i])); } } fireChangeEvent (); }
/** Registers a Factory for given cookie class */ public void add(Class cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } synchronized (this) { registerCookie (cookieClass, new CookieEntry(factory, cookieClass)); } fireChangeEvent (); }
/** Registers a Factory for given cookie class */ public void add(Class cookieClass, Factory factory) { if (factory == null) { throw new IllegalArgumentException(); } synchronized (this) { registerCookie (cookieClass, new CookieEntry(factory, cookieClass)); } fireChangeEvent (); }
/** Attaches cookie to given class and all its superclasses and * superinterfaces. * * @param c class or null * @param cookie cookie to attach */ private void registerCookie (Class c, Node.Cookie cookie) { if ((c == null) || !Node.Cookie.class.isAssignableFrom(c)) return; R r = findR (c); if (r == null) { r = new R (); map.put (c, r); } r.add (cookie); registerCookie (c.getSuperclass (), cookie); Class[] inter = c.getInterfaces (); for (int i = 0; i < inter.length; i++) { registerCookie (inter[i], cookie); } }
/** Attaches cookie to given class and all its superclasses and * superinterfaces. * * @param c class or null * @param cookie cookie to attach */ private void registerCookie (Class c, Node.Cookie cookie) { if ((c == null) || !Node.Cookie.class.isAssignableFrom(c)) return; R r = findR (c); if (r == null) { r = new R (); map.put (c, r); } r.add (cookie); registerCookie (c.getSuperclass (), cookie); Class[] inter = c.getInterfaces (); for (int i = 0; i < inter.length; i++) { registerCookie (inter[i], cookie); } }