Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java @ 362:5b6ba54d488a
Never return null from a function which is documented to do so.
artifacts/trunk@3443 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 16 Dec 2011 14:05:52 +0000 |
parents | 1d11a0531242 |
children | 1f51f3c46efe |
comparison
equal
deleted
inserted
replaced
361:b47d0464f0db | 362:5b6ba54d488a |
---|---|
5 * Read the file LGPL.txt coming with the software for details | 5 * Read the file LGPL.txt coming with the software for details |
6 * or visit http://www.gnu.org/licenses/ if it does not exist. | 6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
7 */ | 7 */ |
8 package de.intevation.artifactdatabase; | 8 package de.intevation.artifactdatabase; |
9 | 9 |
10 import org.apache.log4j.Logger; | |
11 | |
10 import java.util.ArrayList; | 12 import java.util.ArrayList; |
11 import java.util.List; | 13 import java.util.List; |
14 import java.util.Map; | |
12 import java.util.HashMap; | 15 import java.util.HashMap; |
13 | 16 |
14 import de.intevation.artifacts.ArtifactDatabase; | 17 import de.intevation.artifacts.ArtifactDatabase; |
15 import de.intevation.artifacts.CallContext; | 18 import de.intevation.artifacts.CallContext; |
16 import de.intevation.artifacts.CallMeta; | 19 import de.intevation.artifacts.CallMeta; |
22 * | 25 * |
23 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 26 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
25 */ | 28 */ |
26 public abstract class AbstractCallContext implements CallContext { | 29 public abstract class AbstractCallContext implements CallContext { |
30 | |
31 Logger logger = Logger.getLogger(AbstractCallContext.class); | |
27 | 32 |
28 /** | 33 /** |
29 * The ArtifactDatabase instance. | 34 * The ArtifactDatabase instance. |
30 */ | 35 */ |
31 protected ArtifactDatabaseImpl database; | 36 protected ArtifactDatabaseImpl database; |
113 /** | 118 /** |
114 * Get list of DataProviders that registered for given key. | 119 * Get list of DataProviders that registered for given key. |
115 * @return list (empty list if none found, never null). | 120 * @return list (empty list if none found, never null). |
116 */ | 121 */ |
117 public List<DataProvider> getDataProvider(Object key) { | 122 public List<DataProvider> getDataProvider(Object key) { |
118 return dataProviders != null | 123 if (dataProviders != null) { |
119 ? dataProviders.get(key) | 124 List<DataProvider> list = dataProviders.get(key); |
120 : java.util.Collections.<DataProvider>emptyList(); | 125 return list != null |
126 ? list | |
127 : java.util.Collections.<DataProvider>emptyList(); | |
128 } | |
129 return java.util.Collections.<DataProvider>emptyList(); | |
121 } | 130 } |
131 | |
122 | 132 |
123 /** | 133 /** |
124 * Let a DataProvider register itself with given key. | 134 * Let a DataProvider register itself with given key. |
125 * Multiple DataProvider can register under the same key. | 135 * Multiple DataProvider can register under the same key. |
126 */ | 136 */ |