Package com.nomagic.magicdraw.cookies
Class CookieSet
- java.lang.Object
-
- com.nomagic.magicdraw.cookies.CookieSet
-
@OpenApi public final class CookieSet extends java.lang.ObjectSupport class for storing cookies and retrieving them by representation class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classcom.nomagic.magicdraw.cookies.CookieSet.CookieEntryEntry for one Cookiestatic interfacecom.nomagic.magicdraw.cookies.CookieSet.FactoryFactory for creating cookies of given Classprivate static classcom.nomagic.magicdraw.cookies.CookieSet.RImplementation of the result.
-
Constructor Summary
Constructors Constructor Description CookieSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Cookie cookie)Add a new cookie to the set.voidadd(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Registers a Factory for given cookie classesvoidadd(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Registers a Factory for given cookie classvoidaddChangeListener(javax.swing.event.ChangeListener l)Add a listener to changes in the cookie set.private com.nomagic.magicdraw.cookies.CookieSet.RfindR(java.lang.Class c)Finds a result in a map.private voidfireChangeEvent()Fires change eventCookiegetCookie(java.lang.Class clazz)Get a cookie.private voidregisterCookie(java.lang.Class c, Cookie cookie)Attaches cookie to given class and all its superclasses and superinterfaces.voidremove(Cookie cookie)Remove a cookie from the set.voidremove(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Unregisters a Factory for given cookie classesvoidremove(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Unregisters a Factory for given cookie classvoidremoveChangeListener(javax.swing.event.ChangeListener l)Remove a listener to changes in the cookie set.private voidunregisterCookie(java.lang.Class c, Cookie cookie)Removes cookie from the class and all its superclasses and superinterfaces.
-
-
-
Method Detail
-
add
@OpenApi public void add(Cookie cookie)
Add a new cookie to the set. If a cookie of the same actual (not representation!) class is already there, it is replaced.Cookies inserted earlier are given preference during lookup, in case a supplied representation class matches more than one cookie in the set.
- Parameters:
cookie- cookie to add
-
remove
@OpenApi public void remove(Cookie cookie)
Remove a cookie from the set.- Parameters:
cookie- the cookie to remove
-
getCookie
@CheckForNull @OpenApi public Cookie getCookie(java.lang.Class clazz)
Get a cookie.- Parameters:
clazz- the representation class- Returns:
- a cookie assignable to the representation class, or
nullif there is none
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Add a listener to changes in the cookie set.- Parameters:
l- the listener to add
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Remove a listener to changes in the cookie set.- Parameters:
l- the listener to remove
-
fireChangeEvent
private void fireChangeEvent()
Fires change event
-
registerCookie
private void registerCookie(java.lang.Class c, Cookie cookie)Attaches cookie to given class and all its superclasses and superinterfaces.- Parameters:
c- class or nullcookie- cookie to attach
-
unregisterCookie
private void unregisterCookie(java.lang.Class c, Cookie cookie)Removes cookie from the class and all its superclasses and superinterfaces.- Parameters:
c- class or nullcookie- cookie to attach
-
add
public void add(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Registers a Factory for given cookie class
-
add
public void add(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Registers a Factory for given cookie classes
-
remove
public void remove(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Unregisters a Factory for given cookie class- Since:
- 2.6
-
remove
public void remove(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)Unregisters a Factory for given cookie classes- Since:
- 2.6
-
findR
private com.nomagic.magicdraw.cookies.CookieSet.R findR(java.lang.Class c)
Finds a result in a map.
-
-