bundles/org.eclipse.packagedrone.repo.channel.impl/src/org/eclipse/packagedrone/repo/channel/impl/ChannelServiceImpl.java
protected Optional<ChannelInstance> find ( final By by )
    {
        switch ( by.getType () )
        {
            case ID:
                return findById ( (String)by.getQualifier () );
            case NAME:
                return findByName ( (String)by.getQualifier () );
            case COMPOSITE:
            {
                final By[] bys = (By[])by.getQualifier ();
                for ( final By oneBy : bys )
                {
                    final Optional<ChannelInstance> result = find ( oneBy );
                    if ( result.isPresent () )
                    {
                        return result;
                    }
                }
                return Optional.empty ();
            }
            default:
                throw new IllegalArgumentException ( String.format ( "Unknown locator type: %s", by.getType () ) );
        }
    }
protected Optional<ChannelInstance> find ( final By by )
    {
        switch ( by.getType () )
        {
            case ID:
                return findById ( (String)by.getQualifier () );
            case NAME:
                return findByName ( (String)by.getQualifier () );
            case COMPOSITE:
            {
                final By[] bys = (By[])by.getQualifier ();
                for ( final By oneBy : bys )
                {
                    final Optional<ChannelInstance> result = find ( oneBy );
                    if ( result.isPresent () )
                    {
                        return result;
                    }
                }
                return Optional.empty ();
            }
            default:
                throw new IllegalArgumentException ( String.format ( "Unknown locator type: %s", by.getType () ) );
        }
    }
protected Optional < ChannelInstance > find ( final By by ) { switch ( by . getType ( ) ) { case ID : return findById ( ( String ) by . getQualifier ( ) ) ; case NAME : return findByName ( ( String ) by . getQualifier ( ) ) ; case COMPOSITE : { final By [ ] bys = ( By [ ] ) by . getQualifier ( ) ; for ( final By oneBy : bys ) { final Optional < ChannelInstance > result = find ( oneBy ) ; if ( result . isPresent ( ) ) { return result ; } } return Optional . empty ( ) ; } default : throw new IllegalArgumentException ( String . format ( "Unknown locator type: %s" , by . getType ( ) ) ) ; } }
Find by the locator
<p>
This method does not acquire the read lock, this has to be done by the
caller
</p>

@param by
the locator
@return the result
Find by the locator <p > This method does not acquire the read lock this has to be done by the caller < / p >