Author: jdonnerstag
Date: Wed Apr  9 07:18:13 2008
New Revision: 646374

URL: http://svn.apache.org/viewvc?rev=646374&view=rev
Log:
generics

Modified:
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentBorder.java
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentSource.java
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IResourceListener.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupFragmentFinder.java
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestListenerInterface.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentBorder.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentBorder.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentBorder.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentBorder.java
 Wed Apr  9 07:18:13 2008
@@ -32,13 +32,13 @@
         * 
         * @param component
         */
-       public void renderBefore(Component component);
+       public void renderBefore(Component< ? > component);
 
        /**
         * Called after the component is renderd.
         * 
         * @param component
         */
-       public void renderAfter(Component component);
+       public void renderAfter(Component< ? > component);
 
 }

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentSource.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentSource.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentSource.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IComponentSource.java
 Wed Apr  9 07:18:13 2008
@@ -39,5 +39,5 @@
         * @param id
         * @return
         */
-       public Component restoreComponent(String id);
+       public Component< ? > restoreComponent(String id);
 }

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IResourceListener.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IResourceListener.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IResourceListener.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/IResourceListener.java
 Wed Apr  9 07:18:13 2008
@@ -37,10 +37,10 @@
 {
        /** Resource listener interface object */
        public static final RequestListenerInterface INTERFACE = new 
RequestListenerInterface(
-                       IResourceListener.class)
+               IResourceListener.class)
        {
-               public IRequestTarget newRequestTarget(Page page, Component 
component,
-                               RequestListenerInterface listener, 
RequestParameters requestParameters)
+               public IRequestTarget newRequestTarget(Page page, Component< ? 
> component,
+                       RequestListenerInterface listener, RequestParameters 
requestParameters)
                {
                        return new ComponentResourceRequestTarget(page, 
component, listener);
                }

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java 
(original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java 
Wed Apr  9 07:18:13 2008
@@ -55,7 +55,7 @@
        private static final String NULL_VALUE = "<null-value>";
 
        /** Cache properties */
-       private Map cache = newCache();
+       private Map<String, String> cache = newCache();
 
        /**
         * Create the utils instance class backed by the configuration 
information contained within the
@@ -72,7 +72,7 @@
        {
                if (cache != null)
                {
-                       cache = new ConcurrentHashMap();
+                       cache = newCache();
                }
        }
 
@@ -87,7 +87,7 @@
         * @throws MissingResourceException
         *             If resource not found and configuration dictates that 
exception should be thrown
         */
-       public String getString(final String key, final Component component)
+       public String getString(final String key, final Component< ? > 
component)
                throws MissingResourceException
        {
                return getString(key, component, null, null);
@@ -106,8 +106,8 @@
         * @throws MissingResourceException
         *             If resource not found and configuration dictates that 
exception should be thrown
         */
-       public String getString(final String key, final Component component, 
final IModel model)
-               throws MissingResourceException
+       public String getString(final String key, final Component< ? > 
component,
+               final IModel< ? > model) throws MissingResourceException
        {
                return getString(key, component, model, null);
        }
@@ -125,8 +125,8 @@
         * @throws MissingResourceException
         *             If resource not found and configuration dictates that 
exception should be thrown
         */
-       public String getString(final String key, final Component component, 
final String defaultValue)
-               throws MissingResourceException
+       public String getString(final String key, final Component< ? > 
component,
+               final String defaultValue) throws MissingResourceException
        {
                return getString(key, component, null, defaultValue);
        }
@@ -145,8 +145,8 @@
         * 
         * @Deprecated please use [EMAIL PROTECTED] #getString(String, 
Component, IModel, String)}
         */
-       public String getString(final String key, final Component component, 
final IModel model,
-               final Locale locale, final String style, final String 
defaultValue)
+       public String getString(final String key, final Component< ? > 
component,
+               final IModel< ? > model, final Locale locale, final String 
style, final String defaultValue)
                throws MissingResourceException
        {
                return getString(key, component, model, defaultValue);
@@ -170,8 +170,8 @@
         * @throws MissingResourceException
         *             If resource not found and configuration dictates that 
exception should be thrown
         */
-       public String getString(final String key, final Component component, 
final IModel model,
-               final String defaultValue) throws MissingResourceException
+       public String getString(final String key, final Component< ? > 
component,
+               final IModel< ? > model, final String defaultValue) throws 
MissingResourceException
        {
                final IResourceSettings resourceSettings = 
Application.get().getResourceSettings();
 
@@ -214,10 +214,11 @@
                        // Iterate over all registered string resource loaders 
until the
                        // property has been found
 
-                       Iterator iter = 
resourceSettings.getStringResourceLoaders().iterator();
+                       Iterator<IStringResourceLoader> iter = 
resourceSettings.getStringResourceLoaders()
+                               .iterator();
                        while (iter.hasNext())
                        {
-                               IStringResourceLoader loader = 
(IStringResourceLoader)iter.next();
+                               IStringResourceLoader loader = iter.next();
                                string = loader.loadStringResource(component, 
key);
                                if (string != null)
                                {
@@ -293,7 +294,7 @@
         */
        protected String getFromCache(final String cacheKey)
        {
-               final String value = (String)cache.get(cacheKey);
+               final String value = cache.get(cacheKey);
 
                // ConcurrentHashMap does not allow null values
                if (value == NULL_VALUE)
@@ -313,14 +314,14 @@
         * @param component
         * @return The value of the key
         */
-       protected String getCacheKey(final String key, final Component 
component)
+       protected String getCacheKey(final String key, final Component< ? > 
component)
        {
                String cacheKey = key;
                if (component != null)
                {
                        AppendingStringBuffer buffer = new 
AppendingStringBuffer(key);
 
-                       Component cursor = component;
+                       Component< ? > cursor = component;
                        while (cursor != null)
                        {
                                
buffer.append("-").append(cursor.getClass().getName());
@@ -349,8 +350,8 @@
         *            The model
         * @return The resulting string
         */
-       public String substitutePropertyExpressions(final Component component, 
final String string,
-               final IModel model)
+       public String substitutePropertyExpressions(final Component< ? > 
component,
+               final String string, final IModel< ? > model)
        {
                if ((string != null) && (model != null))
                {
@@ -381,8 +382,8 @@
         * 
         * @return cache
         */
-       private Map newCache()
+       private Map<String, String> newCache()
        {
-               return new ConcurrentHashMap();
+               return new ConcurrentHashMap<String, String>();
        }
 }

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupFragmentFinder.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupFragmentFinder.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupFragmentFinder.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupFragmentFinder.java
 Wed Apr  9 07:18:13 2008
@@ -44,10 +44,10 @@
         * @param component
         * @return A MarkupStream which is positioned at the component
         */
-       final MarkupStream find(final Component component)
+       final MarkupStream find(final Component< ? > component)
        {
                // Get the parent's associated markup stream.
-               MarkupContainer parentWithAssociatedMarkup = 
component.findParentWithAssociatedMarkup();
+               MarkupContainer< ? > parentWithAssociatedMarkup = 
component.findParentWithAssociatedMarkup();
                MarkupStream markupStream = null;
 
                // Might be that we have to walk up the component hierarchy
@@ -100,8 +100,7 @@
 
                        if (parentWithAssociatedMarkup instanceof Fragment)
                        {
-                               markupStream = 
((Fragment)parentWithAssociatedMarkup).findComponentIndex(component
-                                               .getId());
+                               markupStream = 
((Fragment)parentWithAssociatedMarkup).findComponentIndex(component.getId());
                                return markupStream;
                        }
 
@@ -110,14 +109,13 @@
                        // ...
                        if (parentWithAssociatedMarkup instanceof Border)
                        {
-                               parentWithAssociatedMarkup = 
parentWithAssociatedMarkup
-                                               
.findParentWithAssociatedMarkup();
+                               parentWithAssociatedMarkup = 
parentWithAssociatedMarkup.findParentWithAssociatedMarkup();
                        }
                        else
                        {
                                throw new WicketRuntimeException(
-                                               "Unable to find the markup for 
the component. That may be due to transparent containers or components 
implementing IComponentResolver: " +
-                                                               
component.toString());
+                                       "Unable to find the markup for the 
component. That may be due to transparent containers or components implementing 
IComponentResolver: " +
+                                               component.toString());
                        }
 
                        // Not found, reset the stream
@@ -132,12 +130,11 @@
         * @param parentWithAssociatedMarkup
         * @return the relative path
         */
-       private String getComponentRelativePath(final Component component,
-                       final MarkupContainer parentWithAssociatedMarkup)
+       private String getComponentRelativePath(final Component< ? > component,
+               final MarkupContainer< ? > parentWithAssociatedMarkup)
        {
                final String componentPath = 
component.getParent().getPageRelativePath();
-               final String parentWithAssociatedMarkupPath = 
parentWithAssociatedMarkup
-                               .getPageRelativePath();
+               final String parentWithAssociatedMarkupPath = 
parentWithAssociatedMarkup.getPageRelativePath();
                String relativePath = 
componentPath.substring(parentWithAssociatedMarkupPath.length());
                if (relativePath.startsWith(":"))
                {

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestListenerInterface.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestListenerInterface.java?rev=646374&r1=646373&r2=646374&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestListenerInterface.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestListenerInterface.java
 Wed Apr  9 07:18:13 2008
@@ -38,7 +38,7 @@
 public class RequestListenerInterface
 {
        /** Map from name to request listener interface */
-       private static final Map interfaces = Collections.synchronizedMap(new 
HashMap());
+       private static final Map<String, RequestListenerInterface> interfaces = 
Collections.synchronizedMap(new HashMap<String, RequestListenerInterface>());
 
        /** Log. */
        private static final Logger log = 
LoggerFactory.getLogger(RequestListenerInterface.class);
@@ -53,7 +53,7 @@
         */
        public static final RequestListenerInterface forName(final String 
interfaceName)
        {
-               return (RequestListenerInterface)interfaces.get(interfaceName);
+               return interfaces.get(interfaceName);
        }
 
        /** The listener interface method */
@@ -69,19 +69,17 @@
         */
        private boolean recordsPageVersion = true;
 
-
        /**
         * Constructor that creates listener interfaces which record the page 
version.
         * 
         * @param listenerInterfaceClass
         *            The interface class, which must extend IRequestListener.
         */
-       public RequestListenerInterface(final Class listenerInterfaceClass)
+       public RequestListenerInterface(final Class< ? extends 
IRequestListener> listenerInterfaceClass)
        {
                this(listenerInterfaceClass, true);
        }
 
-
        /**
         * Constructor.
         * 
@@ -91,13 +89,14 @@
         *            Whether or not urls encoded for this interface contain 
the page version. If set to
         *            false the latest page version is always used.
         */
-       public RequestListenerInterface(final Class listenerInterfaceClass, 
boolean recordsPageVersion)
+       public RequestListenerInterface(
+               final Class< ? extends IRequestListener> 
listenerInterfaceClass, boolean recordsPageVersion)
        {
                // Ensure that it extends IRequestListener
                if 
(!IRequestListener.class.isAssignableFrom(listenerInterfaceClass))
                {
                        throw new IllegalArgumentException("Class " + 
listenerInterfaceClass +
-                                       " must extend IRequestListener");
+                               " must extend IRequestListener");
                }
 
                this.recordsPageVersion = recordsPageVersion;
@@ -116,13 +115,13 @@
                        else
                        {
                                throw new IllegalArgumentException("Method " + 
methods[0] + " in interface " +
-                                               listenerInterfaceClass + " 
cannot take any arguments");
+                                       listenerInterfaceClass + " cannot take 
any arguments");
                        }
                }
                else
                {
                        throw new IllegalArgumentException("Interface " + 
listenerInterfaceClass +
-                                       " can have only one method");
+                               " can have only one method");
                }
 
                // Save short class name
@@ -165,7 +164,7 @@
         * @param component
         *            The component
         */
-       public final void invoke(final Page page, final Component component)
+       public final void invoke(final Page page, final Component< ? > 
component)
        {
                if (!component.isEnabled() || !component.isVisibleInHierarchy())
                {
@@ -186,20 +185,20 @@
                {
                        // Honor redirect exception contract defined in 
IPageFactory
                        if (e.getTargetException() instanceof 
AbstractRestartResponseException ||
-                                       e.getTargetException() instanceof 
AuthorizationException ||
-                                       e.getTargetException() instanceof 
WicketRuntimeException)
+                               e.getTargetException() instanceof 
AuthorizationException ||
+                               e.getTargetException() instanceof 
WicketRuntimeException)
                        {
                                throw (RuntimeException)e.getTargetException();
                        }
                        throw new WicketRuntimeException("Method " + 
method.getName() + " of " +
-                                       method.getDeclaringClass() + " targeted 
at component " + component +
-                                       " threw an exception", e);
+                               method.getDeclaringClass() + " targeted at 
component " + component +
+                               " threw an exception", e);
                }
                catch (Exception e)
                {
                        throw new WicketRuntimeException("Method " + 
method.getName() + " of " +
-                                       method.getDeclaringClass() + " targeted 
at component " + component +
-                                       " threw an exception", e);
+                               method.getDeclaringClass() + " targeted at 
component " + component +
+                               " threw an exception", e);
                }
                finally
                {
@@ -220,8 +219,8 @@
         *            Request parameters
         * @return The request target
         */
-       public IRequestTarget newRequestTarget(final Page page, final Component 
component,
-                       final RequestListenerInterface listener, final 
RequestParameters requestParameters)
+       public IRequestTarget newRequestTarget(final Page page, final 
Component< ? > component,
+               final RequestListenerInterface listener, final 
RequestParameters requestParameters)
        {
                return new ListenerInterfaceRequestTarget(page, component, 
listener, requestParameters);
        }
@@ -238,6 +237,7 @@
        /**
         * @see java.lang.Object#toString()
         */
+       @Override
        public String toString()
        {
                return "[RequestListenerInterface name=" + name + ", method=" + 
method + "]";
@@ -257,19 +257,17 @@
         *            The request listener interface object
         */
        private final void registerRequestListenerInterface(
-                       final RequestListenerInterface requestListenerInterface)
+               final RequestListenerInterface requestListenerInterface)
        {
                // Check that a different interface method with the same name 
has not
                // already been registered
-               final RequestListenerInterface existingInterface = 
RequestListenerInterface
-                               .forName(requestListenerInterface.getName());
+               final RequestListenerInterface existingInterface = 
RequestListenerInterface.forName(requestListenerInterface.getName());
                if (existingInterface != null &&
-                               existingInterface.getMethod() != 
requestListenerInterface.getMethod())
+                       existingInterface.getMethod() != 
requestListenerInterface.getMethod())
                {
                        throw new IllegalStateException("Cannot register 
listener interface " +
-                                       requestListenerInterface +
-                                       " because it conflicts with the already 
registered interface " +
-                                       existingInterface);
+                               requestListenerInterface +
+                               " because it conflicts with the already 
registered interface " + existingInterface);
                }
 
                // Save this interface method by the non-qualified class name


Reply via email to