mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-20 15:27:24 +00:00
singleton range shorthand
This commit is contained in:
1 parent
d09fe9b2a4
commit
9d12fe1bf1
1 file changed
+7
-2
@@ -14,7 +14,12 @@ import java.util.Map;
|
||||
public class RangeLoader implements TypeLoader<Range> {
|
||||
@Override
|
||||
public Range load(AnnotatedType type, Object o, ConfigLoader configLoader) throws LoadException {
|
||||
Map<String, Integer> map = (Map<String, Integer>) o;
|
||||
return new ConstantRange(map.get("min"), map.get("max"));
|
||||
if(o instanceof Map) {
|
||||
Map<String, Integer> map = (Map<String, Integer>) o;
|
||||
return new ConstantRange(map.get("min"), map.get("max"));
|
||||
} else {
|
||||
int h = configLoader.loadType(Integer.class, o);
|
||||
return new ConstantRange(h, h+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user