"alesj" wrote : "alesj" wrote :
| | How do we know level hierarchy?
| OK, ScopeLevel implements Comparable. :-)
I've added simple util class, to get sub levels:
| package org.jboss.metadata.spi.scope;
|
| public class CommonLevelsUtil
| {
| ...
|
| /**
| * Get the levels (including level param) that
| * are below level param.
| *
| * @param level the flag level
| * @return sub list of levels
| */
| public static List<ScopeLevel> getSubLevels(ScopeLevel level)
| {
| int index = levels.indexOf(level);
| if (index < 0)
| throw new IllegalArgumentException("No such scope level in levels:
" + level);
| return levels.subList(index, size);
| }
|
| /**
| * Get the levels that are exclusively below level param.
| *
| * @param level the flag level
| * @return sub list of levels
| */
| public static List<ScopeLevel> getExclusiveSubLevels(ScopeLevel level)
| {
| int index = levels.indexOf(level);
| if (index < 0)
| throw new IllegalArgumentException("No such scope level in levels:
" + level);
|
| if (index + 1 == size)
| return Collections.emptyList();
|
| return levels.subList(index + 1, size);
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140440#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...