public static < S extends Storable > OrderedProperty < S > parse ( StorableInfo < S > info , String str , Direction defaultDirection ) throws IllegalArgumentException { if ( info == null || str == null || defaultDirection == null ) { throw new IllegalArgumentException ( ) ; } Direction direction = defaultDirection ; if ( str . length ( ) > 0 ) { if ( str . charAt ( 0 ) == ' ' ) { direction = Direction . ASCENDING ; str = str . substring ( 1 ) ; } else if ( str . charAt ( 0 ) == ' ' ) { direction = Direction . DESCENDING ; str = str . substring ( 1 ) ; } else if ( str . charAt ( 0 ) == ' ' ) { direction = Direction . UNSPECIFIED ; str = str . substring ( 1 ) ; } } if ( direction == null ) { direction = Direction . ASCENDING ; } return get ( ChainedProperty . parse ( info , str ) , direction ) ; }
Parses an ordering property which may start with a + or - to indicate direction . Prefix of ~ indicates unspecified direction .