Package com.nomagic.magicdraw.cookies
Class CookieSet
- java.lang.Object
-
- com.nomagic.magicdraw.cookies.CookieSet
-
@OpenApi public final class CookieSet extends java.lang.Object
Support class for storing cookies and retrieving them by representation class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
com.nomagic.magicdraw.cookies.CookieSet.CookieEntry
Entry for one Cookiestatic interface
com.nomagic.magicdraw.cookies.CookieSet.Factory
Factory for creating cookies of given Classprivate static class
com.nomagic.magicdraw.cookies.CookieSet.R
Implementation of the result.
-
Constructor Summary
Constructors Constructor Description CookieSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Cookie cookie)
Add a new cookie to the set.void
add(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)
Registers a Factory for given cookie classesvoid
add(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)
Registers a Factory for given cookie classvoid
addChangeListener(javax.swing.event.ChangeListener l)
Add a listener to changes in the cookie set.private com.nomagic.magicdraw.cookies.CookieSet.R
findR(java.lang.Class c)
Finds a result in a map.private void
fireChangeEvent()
Fires change eventCookie
getCookie(java.lang.Class clazz)
Get a cookie.private void
registerCookie(java.lang.Class c, Cookie cookie)
Attaches cookie to given class and all its superclasses and superinterfaces.void
remove(Cookie cookie)
Remove a cookie from the set.void
remove(java.lang.Class[] cookieClasses, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)
Unregisters a Factory for given cookie classesvoid
remove(java.lang.Class cookieClass, com.nomagic.magicdraw.cookies.CookieSet.Factory factory)
Unregisters a Factory for given cookie classvoid
removeChangeListener(javax.swing.event.ChangeListener l)
Remove a listener to changes in the cookie set.private void
unregisterCookie(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
null
if 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.
-
-