[webbeans-commits] Webbeans SVN: r2258 - ri/trunk/impl/src/main/java/org/jboss/webbeans/context.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Mar 29 19:33:10 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-29 19:33:10 -0400 (Sun, 29 Mar 2009)
New Revision: 2258

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentStorageRequest.java
Log:
fix equals

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentStorageRequest.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentStorageRequest.java	2009-03-29 23:14:16 UTC (rev 2257)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentStorageRequest.java	2009-03-29 23:33:10 UTC (rev 2258)
@@ -1,94 +1,97 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.context;
-
-/**
- * A dependent instance store and storage key combination for selecting the correct receiving 
- * store and holding key for dependent instances in the dependent context
- *  
- * @author Nicklas Karlsson
- */
-public class DependentStorageRequest
-{
-   // The dependent instances store to target
-   private DependentInstancesStore dependentInstancesStore;
-   // The key in the store
-   private Object key;
-
-   /**
-    * Create a new DependentStoreKey
-    * 
-    * @param dependentInstancesStore The dependent instances store
-    * @param key The storage key
-    */
-   protected DependentStorageRequest(DependentInstancesStore dependentInstancesStore, Object key)
-   {
-      this.dependentInstancesStore = dependentInstancesStore;
-      this.key = key;
-   }
-
-   /**
-    * Static factory method
-    * 
-    * @param scopeType The scope type of the dependent instances store
-    * @param key The storage key
-    * @return A new DependentStoreKey
-    */
-   public static DependentStorageRequest of(DependentInstancesStore dependentInstancesStore, Object key)
-   {
-      return new DependentStorageRequest(dependentInstancesStore, key);
-   }
-
-   /**
-    * Gets the store
-    * 
-    * @return The store
-    */
-   public DependentInstancesStore getDependentInstancesStore()
-   {
-      return dependentInstancesStore;
-   }
-
-   /**
-    * Gets the key
-    * 
-    * @return The key
-    */
-   public Object getKey()
-   {
-      return key;
-   }
-
-   @Override
-   public boolean equals(Object other)
-   {
-      if (other == null) {
-         return false;
-      }
-      DependentStorageRequest otherRequest = (DependentStorageRequest) other;
-      if (dependentInstancesStore != otherRequest.getDependentInstancesStore())
-      {
-         return false;
-      }
-      if (!key.equals(otherRequest.getKey()))
-      {
-         return false;
-      }
-      return true;
-   }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.context;
+
+/**
+ * A dependent instance store and storage key combination for selecting the correct receiving 
+ * store and holding key for dependent instances in the dependent context
+ *  
+ * @author Nicklas Karlsson
+ */
+public class DependentStorageRequest
+{
+   // The dependent instances store to target
+   private final DependentInstancesStore dependentInstancesStore;
+   // The key in the store
+   private final Object key;
+
+   /**
+    * Create a new DependentStoreKey
+    * 
+    * @param dependentInstancesStore The dependent instances store
+    * @param key The storage key
+    */
+   protected DependentStorageRequest(DependentInstancesStore dependentInstancesStore, Object key)
+   {
+      this.dependentInstancesStore = dependentInstancesStore;
+      this.key = key;
+   }
+
+   /**
+    * Static factory method
+    * 
+    * @param scopeType The scope type of the dependent instances store
+    * @param key The storage key
+    * @return A new DependentStoreKey
+    */
+   public static DependentStorageRequest of(DependentInstancesStore dependentInstancesStore, Object key)
+   {
+      return new DependentStorageRequest(dependentInstancesStore, key);
+   }
+
+   /**
+    * Gets the store
+    * 
+    * @return The store
+    */
+   public DependentInstancesStore getDependentInstancesStore()
+   {
+      return dependentInstancesStore;
+   }
+
+   /**
+    * Gets the key
+    * 
+    * @return The key
+    */
+   public Object getKey()
+   {
+      return key;
+   }
+
+   @Override
+   public boolean equals(Object other)
+   {
+      if (other instanceof DependentStorageRequest)
+      {
+         DependentStorageRequest that = (DependentStorageRequest) other;
+         if (this.getDependentInstancesStore().equals(that.getDependentInstancesStore()) && this.getKey().equals(that.getKey()))
+         {
+            return true;
+         }
+         else
+         {
+            return false;
+         }
+      }
+      else
+      {
+         return false;
+      }
+   }
+
+}




More information about the weld-commits mailing list