private Object toReference ( int type , Object referent , int hash ) { switch ( type ) { case HARD : return referent ; case SOFT : return new SoftRef ( hash , referent , queue ) ; case WEAK : return new WeakRef ( hash , referent , queue ) ; default : throw new Error ( ) ; } }
Constructs a reference of the given type to the given referent . The reference is registered with the queue for later purging .