}
else if ( key.startsWith("@") || key.contains( "@(" ) ) {
return TransposePathElement.parse( key );
}
else if ( key.contains( "@" ) ) {
throw new SpecException( "Invalid key:" + key + " can not have an @ other than at the front." );
}
else if ( key.contains("$") ) {
return new DollarPathElement( key );
}
else if ( key.contains("[") ) {
if ( StringTools.countMatches(key, "[") != 1 || StringTools.countMatches(key, "]") != 1 ) {
throw new SpecException( "Invalid key:" + key + " has too many [] references.");
}
return new ArrayPathElement( key );
}
else if ( key.contains( "&" ) ) {
if ( key.contains("*") )
{
throw new SpecException("Can't mix * with & ) ");
}
return new AmpPathElement( key );
}
else if ( "*".equals( key ) ) {
return new StarAllPathElement( key );