/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }
/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }
/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }
/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }
/** * Returns the first item matching the mime type<br> * NOTE: The order in which the services are loaded an examined is not * deterministic so this method may return different results if the * MIME-Type matches more than one item. However, if the default MIME-Types * are always unique, the correct item will always be chosen * * @param mimeType A MIME type to use for choosing an item * @return An item matching the given mime type or null if none were found. */ public PriorityCollection<T> getByMIMEType(String mimeType) { checkNotNull(mimeType, "MIME-Type cannot be null"); PriorityCollection<T> pc = new PriorityCollection<>(configurationHolder); // adding directly to the delegate. No need to order because insertion // will be ordered as in this PriorityCollection for (T t : delegate) { // if the instance has MIME types associated if (t instanceof MIMETypeAware) { MIMETypeAware mimeTypeAware = (MIMETypeAware) t; if (mimeType.equals(mimeTypeAware.getDefaultMIMEType())) { pc.add(t); } else { if (mimeTypeAware.getMIMETypes().contains(mimeType)) { pc.add(t); } } } } return pc; }
/** * Returns the first item matching the mime type<br> * NOTE: The order in which the services are loaded an examined is not * deterministic so this method may return different results if the * MIME-Type matches more than one item. However, if the default MIME-Types * are always unique, the correct item will always be chosen * * @param mimeType A MIME type to use for choosing an item * @return An item matching the given mime type or null if none were found. */ public PriorityCollection<T> getByMIMEType(String mimeType) { checkNotNull(mimeType, "MIME-Type cannot be null"); PriorityCollection<T> pc = new PriorityCollection<>(configurationHolder); // adding directly to the delegate. No need to order because insertion // will be ordered as in this PriorityCollection for (T t : delegate) { // if the instance has MIME types associated if (t instanceof MIMETypeAware) { MIMETypeAware mimeTypeAware = (MIMETypeAware) t; if (mimeType.equals(mimeTypeAware.getDefaultMIMEType())) { pc.add(t); } else { if (mimeTypeAware.getMIMETypes().contains(mimeType)) { pc.add(t); } } } } return pc; }
/** * Returns the first item matching the mime type<br> * NOTE: The order in which the services are loaded an examined is not * deterministic so this method may return different results if the * MIME-Type matches more than one item. However, if the default MIME-Types * are always unique, the correct item will always be chosen * * @param mimeType A MIME type to use for choosing an item * @return An item matching the given mime type or null if none were found. */ public PriorityCollection<T> getByMIMEType(String mimeType) { checkNotNull(mimeType, "MIME-Type cannot be null"); PriorityCollection<T> pc = new PriorityCollection<>(configurationHolder); // adding directly to the delegate. No need to order because insertion // will be ordered as in this PriorityCollection for (T t : delegate) { // if the instance has MIME types associated if (t instanceof MIMETypeAware) { MIMETypeAware mimeTypeAware = (MIMETypeAware) t; if (mimeType.equals(mimeTypeAware.getDefaultMIMEType())) { pc.add(t); } else { if (mimeTypeAware.getMIMETypes().contains(mimeType)) { pc.add(t); } } } } return pc; }