Add a debug check to sniff out errors like typos

This commit is contained in:
Glease committed 2021-09-08 22:07:50 +08:00
1 parent a069612e04
commit 4982bb780d
2 files changed
+7 -1

No files matched your search

@@ -13,8 +13,11 @@ public interface IStructureDefinition<T> {
/**
* Used internally
*
* Might, but is not required, to throw {@link java.util.NoSuchElementException} if the given structure piece is not found.
*
* @param name same name as for other methods here
* @return the array of elements to process
* @throws java.util.NoSuchElementException if the given structure piece is not found and the moon phase perfectly matches
*/
IStructureElement<T>[] getStructureFor(String name);
@@ -193,6 +193,9 @@ public class StructureDefinition<T> implements IStructureDefinition<T> {
@Override
public IStructureElement<T>[] getStructureFor(String name) {
return structures.get(name);
IStructureElement<T>[] elements = structures.get(name);
if (elements == null)
throw new NoSuchElementException(name);
return elements;
}
}