@ Override public ScriptableObject . Slot get ( Object key , int index , ScriptableObject . SlotAccess accessType ) { if ( slots == null && accessType == SlotAccess . QUERY ) { return null ; } final int indexOrHash = ( key != null ? key . hashCode ( ) : index ) ; ScriptableObject . Slot slot = null ; if ( slots != null ) { final int slotIndex = getSlotIndex ( slots . length , indexOrHash ) ; for ( slot = slots [ slotIndex ] ; slot != null ; slot = slot . next ) { Object skey = slot . name ; if ( indexOrHash == slot . indexOrHash && ( skey == key || ( key != null && key . equals ( skey ) ) ) ) { break ; } } switch ( accessType ) { case QUERY : return slot ; case MODIFY : case MODIFY_CONST : if ( slot != null ) { return slot ; } break ; case MODIFY_GETTER_SETTER : if ( slot instanceof ScriptableObject . GetterSlot ) { return slot ; } break ; case CONVERT_ACCESSOR_TO_DATA : if ( ! ( slot instanceof ScriptableObject . GetterSlot ) ) { return slot ; } break ; } } // A new slot has to be inserted or the old has to be replaced // by GetterSlot. Time to synchronize. return createSlot ( key , indexOrHash , accessType , slot ) ; }
Locate the slot with given name or index . Depending on the accessType parameter and the current slot status a new slot may be allocated .