public List<T> createSpec(Map<String, Object> rawSpec) {
        List<T> result = new ArrayList<>();
        Set<String> actualKeys = new HashSet<>();

        for ( String rawLhsStr : rawSpec.keySet() ) {

            Object rawRhs = rawSpec.get( rawLhsStr );
            String[] keyStrings = rawLhsStr.split( "\\|" ); // unwrap the syntactic sugar of the OR
            for ( String keyString : keyStrings ) {

                T childSpec = createSpec( keyString, rawRhs );

                String childCanonicalString = childSpec.getPathElement().getCanonicalForm();

                if ( actualKeys.contains( childCanonicalString ) ) {
                    throw new IllegalArgumentException( "Duplicate canonical key found : " + childCanonicalString );
                }

                actualKeys.add( childCanonicalString );

                result.add(childSpec);
            }
        }

        return result;
    }
public List < T > createSpec ( Map < String , Object > rawSpec ) { List < T > result = new ArrayList < > ( ) ; Set < String > actualKeys = new HashSet < > ( ) ; for ( String rawLhsStr : rawSpec . keySet ( ) ) { Object rawRhs = rawSpec . get ( rawLhsStr ) ; String [ ] keyStrings = rawLhsStr . split ( "\\|" ) ; for ( String keyString : keyStrings ) { T childSpec = createSpec ( keyString , rawRhs ) ; String childCanonicalString = childSpec . getPathElement ( ) . getCanonicalForm ( ) ; if ( actualKeys . contains ( childCanonicalString ) ) { throw new IllegalArgumentException ( "Duplicate canonical key found : " + childCanonicalString ) ; } actualKeys . add ( childCanonicalString ) ; result . add ( childSpec ) ; } } return result ; }
Recursively walk the spec input tree.