Author: julien(a)jboss.com
Date: 2008-03-12 07:18:57 -0400 (Wed, 12 Mar 2008)
New Revision: 10271
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
Log:
added notion of generic attachment on PortletInfo interface with an implementation in
ContainerPortletInfo
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12
11:15:20 UTC (rev 10270)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12
11:18:57 UTC (rev 10271)
@@ -164,12 +164,27 @@
public <T> T getAttachment(Class<T> type)
{
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
return type.cast(attachments.get(type));
}
public <T> void setAttachment(Class<T> type, T object)
{
- attachments.put(type, object);
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ if (object == null)
+ {
+ attachments.remove(type);
+ }
+ else
+ {
+ attachments.put(type, object);
+ }
}
public String getName()
Show replies by date