public static TransposePathElement parse ( String key ) { if ( key == null || key . length ( ) < 2 ) { throw new SpecException ( "'Transpose Input' key '@', can not be null or of length 1. Offending key : " + key ) ; } if ( ' ' != key . charAt ( 0 ) ) { throw new SpecException ( "'Transpose Input' key must start with an '@'. Offending key : " + key ) ; } // Strip off the leading '@' as we don't need it anymore. String meat = key . substring ( 1 ) ; if ( meat . contains ( "@" ) ) { throw new SpecException ( "@ pathElement can not contain a nested @. Was: " + meat ) ; } if ( meat . contains ( "*" ) || meat . contains ( "[]" ) ) { throw new SpecException ( "'Transpose Input' can not contain expansion wildcards (* and []). Offending key : " + key ) ; } // Check to see if the key is wrapped by parens if ( meat . startsWith ( "(" ) ) { if ( meat . endsWith ( ")" ) ) { meat = meat . substring ( 1 , meat . length ( ) - 1 ) ; } else { throw new SpecException ( "@ path element that starts with '(' must have a matching ')'. Offending key : " + key ) ; } } return innerParse ( key , meat ) ; }
Parse a text value from a Spec into a TransposePathElement .