[New] Changed GroupedParameterizedElement.getParameter()

- now returns <T extends Parameter<?>>
This commit is contained in:
Robert von Burg 2015-12-02 22:04:28 +01:00
parent b10a355b5e
commit 8fdcc00ed7
2 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit 540dbeab32f542b7f4e3747c191d06c66b5108a9 Subproject commit 2008da00a357accb2783147acd0b6bd67580f261

View File

@ -22,10 +22,10 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import ch.eitchnet.utils.helper.StringHelper;
import li.strolch.exception.StrolchException; import li.strolch.exception.StrolchException;
import li.strolch.exception.StrolchModelException; import li.strolch.exception.StrolchModelException;
import li.strolch.model.parameter.Parameter; import li.strolch.model.parameter.Parameter;
import ch.eitchnet.utils.helper.StringHelper;
/** /**
* @author Robert von Burg <eitch@eitchnet.ch> * @author Robert von Burg <eitch@eitchnet.ch>
@ -88,7 +88,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
* *
* @return the found {@link Parameter} or null if it was not found * @return the found {@link Parameter} or null if it was not found
*/ */
public <T> T getParameter(String bagKey, String paramKey) { public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey) {
return getParameter(bagKey, paramKey, false); return getParameter(bagKey, paramKey, false);
} }
@ -105,12 +105,12 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
* *
* @return the found {@link Parameter} or null if it was not found * @return the found {@link Parameter} or null if it was not found
*/ */
public <T> T getParameter(String bagKey, String paramKey, boolean assertExists) { public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey, boolean assertExists) {
if (this.parameterBagMap == null) { if (this.parameterBagMap == null) {
if (assertExists) { if (assertExists) {
String msg = "The Parameter {0} does not exist"; String msg = "The Parameter {0} does not exist";
throw new StrolchModelException(MessageFormat.format(msg, throw new StrolchModelException(
getLocator().append(Tags.BAG, bagKey, paramKey))); MessageFormat.format(msg, getLocator().append(Tags.BAG, bagKey, paramKey)));
} }
return null; return null;
@ -119,8 +119,8 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
if (bag == null) { if (bag == null) {
if (assertExists) { if (assertExists) {
String msg = "The Parameter {0} does not exist"; String msg = "The Parameter {0} does not exist";
throw new StrolchModelException(MessageFormat.format(msg, throw new StrolchModelException(
getLocator().append(Tags.BAG, bagKey, paramKey))); MessageFormat.format(msg, getLocator().append(Tags.BAG, bagKey, paramKey)));
} }
return null; return null;