[Fix] Compile error fixes =(
This commit is contained in:
parent
090d0d394f
commit
ac9d24802c
|
@ -88,7 +88,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
*
|
||||
* @return the found {@link Parameter} or null if it was not found
|
||||
*/
|
||||
public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey) {
|
||||
public <U, T extends Parameter<U>> T getParameter(String bagKey, String paramKey) {
|
||||
return getParameter(bagKey, paramKey, false);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
* @throws StrolchModelException
|
||||
* if the element does not exist and <code>assertExists</code> is true
|
||||
*/
|
||||
public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
public <U, T extends Parameter<U>> T getParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
throws StrolchModelException {
|
||||
if (this.parameterBagMap == null) {
|
||||
if (assertExists) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface ParameterBagContainer extends StrolchElement {
|
|||
*
|
||||
* @return the found {@link Parameter} or null if it was not found
|
||||
*/
|
||||
public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey);
|
||||
public <U, T extends Parameter<U>> T getParameter(String bagKey, String paramKey);
|
||||
|
||||
/**
|
||||
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the given bagKey, or null if
|
||||
|
@ -40,7 +40,7 @@ public interface ParameterBagContainer extends StrolchElement {
|
|||
*
|
||||
* @return the found {@link Parameter} or null if it was not found
|
||||
*/
|
||||
public <T extends Parameter<?>> T getParameter(String bagKey, String paramKey, boolean assertExists);
|
||||
public <U, T extends Parameter<U>> T getParameter(String bagKey, String paramKey, boolean assertExists);
|
||||
|
||||
/**
|
||||
* Adds a new {@link Parameter} to the {@link ParameterBag} with the given key
|
||||
|
|
|
@ -271,7 +271,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey) {
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey) {
|
||||
|
||||
T parameter = getParameter(bagKey, paramKey);
|
||||
if (parameter != null)
|
||||
|
@ -281,7 +281,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
throws StrolchModelException {
|
||||
|
||||
T parameter = getParameter(bagKey, paramKey);
|
||||
|
|
|
@ -370,7 +370,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey) {
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey) {
|
||||
|
||||
T parameter = getParameter(bagKey, paramKey);
|
||||
if (parameter != null)
|
||||
|
@ -383,7 +383,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
throws StrolchModelException {
|
||||
|
||||
T parameter = getParameter(bagKey, paramKey);
|
||||
|
|
|
@ -63,7 +63,7 @@ public interface IActivityElement extends StrolchElement {
|
|||
*
|
||||
* @see GroupedParameterizedElement#getParameter(String, String)
|
||||
*/
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey);
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -77,7 +77,7 @@ public interface IActivityElement extends StrolchElement {
|
|||
*
|
||||
* @see GroupedParameterizedElement#getParameter(String, String, boolean)
|
||||
*/
|
||||
public <T extends Parameter<?>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
throws StrolchModelException;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -113,6 +113,8 @@ public class ModelTest {
|
|||
assertEquals("Test resource", resource.getName());
|
||||
assertEquals("MyType", resource.getType());
|
||||
|
||||
assertParams(resource);
|
||||
|
||||
ParameterBag bag = resource.getParameterBag(BAG_ID);
|
||||
validateBag(bag);
|
||||
|
||||
|
@ -130,6 +132,7 @@ public class ModelTest {
|
|||
assertEquals(date, order.getDate());
|
||||
assertEquals(State.CLOSED, order.getState());
|
||||
|
||||
assertParams(order);
|
||||
ParameterBag bag = order.getParameterBag(BAG_ID);
|
||||
validateBag(bag);
|
||||
}
|
||||
|
@ -155,6 +158,8 @@ public class ModelTest {
|
|||
assertEquals(actName, activity.getName());
|
||||
assertEquals(actType, activity.getType());
|
||||
|
||||
assertParams(activity);
|
||||
|
||||
ParameterBag bag = activity.getParameterBag(BAG_ID);
|
||||
validateBag(bag);
|
||||
|
||||
|
@ -167,6 +172,10 @@ public class ModelTest {
|
|||
assertEquals(ACTION_RES_TYPE, action.getResourceType());
|
||||
assertEquals(changes, action.getChanges());
|
||||
|
||||
assertParams(action);
|
||||
bag = action.getParameterBag(BAG_ID);
|
||||
validateBag(bag);
|
||||
|
||||
activity = activity.getElement("sub_" + actId);
|
||||
assertEquals("sub_" + actId, activity.getId());
|
||||
assertEquals("sub_" + actName, activity.getName());
|
||||
|
@ -389,6 +398,53 @@ public class ModelTest {
|
|||
validateParams(bag);
|
||||
}
|
||||
|
||||
private void assertParams(ParameterBagContainer bagContainer) {
|
||||
Boolean bool = bagContainer.getParameter(BAG_ID, PARAM_BOOLEAN_ID).getValue();
|
||||
assertEquals(true, bool.booleanValue());
|
||||
|
||||
String string = bagContainer.getParameter(BAG_ID, PARAM_STRING_ID).getValue();
|
||||
assertEquals("Strolch", string);
|
||||
|
||||
Integer integer = bagContainer.getParameter(BAG_ID, PARAM_INTEGER_ID).getValue();
|
||||
assertEquals(77, integer.intValue());
|
||||
|
||||
Date date = bagContainer.getParameter(BAG_ID, PARAM_DATE_ID).getValue();
|
||||
assertEquals(1354295525628L, date.getTime());
|
||||
|
||||
Double doubl = bagContainer.getParameter(BAG_ID, PARAM_FLOAT_ID).getValue();
|
||||
assertEquals(44.3, doubl.doubleValue(), 0.0001);
|
||||
|
||||
Long lon = bagContainer.getParameter(BAG_ID, PARAM_LONG_ID).getValue();
|
||||
assertEquals(4453234566L, lon.longValue());
|
||||
|
||||
List<Double> doubles = bagContainer.getParameter(BAG_ID, PARAM_LIST_FLOAT_ID).getValue();
|
||||
ArrayList<Double> floatList = new ArrayList<>();
|
||||
floatList.add(6.0);
|
||||
floatList.add(11.0);
|
||||
floatList.add(16.0);
|
||||
assertEquals(floatList, doubles);
|
||||
|
||||
List<Integer> integers = bagContainer.getParameter(BAG_ID, PARAM_LIST_INTEGER_ID).getValue();
|
||||
ArrayList<Integer> intList = new ArrayList<>();
|
||||
intList.add(5);
|
||||
intList.add(10);
|
||||
intList.add(15);
|
||||
assertEquals(intList, integers);
|
||||
|
||||
List<Long> longs = bagContainer.getParameter(BAG_ID, PARAM_LIST_LONG_ID).getValue();
|
||||
ArrayList<Long> longList = new ArrayList<>();
|
||||
longList.add(7L);
|
||||
longList.add(12L);
|
||||
longList.add(17L);
|
||||
assertEquals(longList, longs);
|
||||
|
||||
List<String> strings = bagContainer.getParameter(BAG_ID, PARAM_LIST_STRING_ID).getValue();
|
||||
ArrayList<String> stringList = new ArrayList<>();
|
||||
stringList.add("Hello");
|
||||
stringList.add("World");
|
||||
assertEquals(stringList, strings);
|
||||
}
|
||||
|
||||
public static void validateParams(ParameterBag bag) {
|
||||
|
||||
BooleanParameter boolParam = bag.getParameter(PARAM_BOOLEAN_ID);
|
||||
|
|
Loading…
Reference in New Issue