@ SuppressWarnings ( "unchecked" ) public StorableIndex < S > buildPkIndex ( String ... propertyNames ) { Map < String , ? extends StorableProperty < S > > map = getAllProperties ( ) ; int length = propertyNames . length ; StorableProperty < S > [ ] properties = new StorableProperty [ length ] ; Direction [ ] directions = new Direction [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { String name = propertyNames [ i ] ; char c = name . charAt ( 0 ) ; Direction dir = Direction . fromCharacter ( c ) ; if ( dir != Direction . UNSPECIFIED || c == Direction . UNSPECIFIED . toCharacter ( ) ) { name = name . substring ( 1 ) ; } else { // Default to ascending if not specified. dir = Direction . ASCENDING ; } if ( ( properties [ i ] = map . get ( name ) ) == null ) { throw new IllegalArgumentException ( "Unknown property: " + name ) ; } directions [ i ] = dir ; } return new StorableIndex < S > ( properties , directions , true , true ) ; }
Convenient way to define the clustered primary key index descriptor . Direction can be specified by prefixing the property name with a + or - . If unspecified direction is assumed to be ascending .