public static < S extends Storable > SyntheticStorableReferenceAccess < S > getIndexAccess ( StorableIndex < S > index ) throws SupportException { // Strip out index property not related to its identity. index = index . clustered ( false ) ; synchronized ( cCache ) { SyntheticStorableReferenceAccess < S > access = cCache . get ( index ) ; if ( access != null ) { return access ; } // Need to try to find the base type. This is an awkward way to do // it, but we have nothing better available to us Class < S > type = index . getProperty ( 0 ) . getEnclosingType ( ) ; SyntheticStorableReferenceBuilder < S > builder = new SyntheticStorableReferenceBuilder < S > ( type , index . isUnique ( ) ) ; for ( int i = 0 ; i < index . getPropertyCount ( ) ; i ++ ) { StorableProperty < S > source = index . getProperty ( i ) ; builder . addKeyProperty ( source . getName ( ) , index . getPropertyDirection ( i ) ) ; } builder . build ( ) ; access = builder . getReferenceAccess ( ) ; cCache . put ( index , access ) ; return access ; } }
Returns a new or cached index access instance . The caching of accessors is soft so if no references remain to a given instance it may be garbage collected . A subsequent call will return a newly created instance .