use of jodd.madvoc.BaseActionWrapperStack in project jodd by oblac.
the class WrapperManager method expand.
/**
* Replaces all {@link #getDefaultWebAppWrapper()} with {@link #getDefaultWebAppWrapper()}
* and {@link BaseActionWrapperStack} with stack values.
*/
protected Class<? extends T>[] expand(Class<? extends T>[] actionWrappers) {
if (actionWrappers == null) {
return null;
}
List<Class<? extends T>> list = new ArrayList<>(actionWrappers.length);
list.addAll(Arrays.asList(actionWrappers));
int i = 0;
while (i < list.size()) {
Class<? extends T> wrapperClass = list.get(i);
if (wrapperClass == null) {
continue;
}
if (wrapperClass.equals(getDefaultWebAppWrapper())) {
list.remove(i);
// add default wrappers list
Class<? extends T>[] defaultWrappers = getDefaultWrappers();
if (defaultWrappers != null) {
int ndx = i;
for (Class<? extends T> defaultWrapper : defaultWrappers) {
// can't add default list stack to default list
if (defaultWrapper.equals(getDefaultWebAppWrapper())) {
throw new MadvocException("Default wrapper list is self-contained (cyclic dependency)!");
}
list.add(ndx, defaultWrapper);
ndx++;
}
}
continue;
}
if (ReflectUtil.isTypeOf(wrapperClass, BaseActionWrapperStack.class)) {
BaseActionWrapperStack stack = (BaseActionWrapperStack) resolve(wrapperClass);
list.remove(i);
Class<? extends T>[] stackWrappers = stack.getWrappers();
if (stackWrappers != null) {
list.addAll(i, Arrays.asList(stackWrappers));
}
i--;
//continue;
}
i++;
}
return list.toArray(new Class[list.size()]);
}
Aggregations