io.annot8.api.capabilities.Capabilities Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annot8-api Show documentation
Show all versions of annot8-api Show documentation
Core API interfaces for the Annot8 project
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.api.capabilities;
import java.util.stream.Stream;
/** Interface for capturing the capabilities of an Annot8 component */
public interface Capabilities {
/**
* Describes the things (e.g. content, annotations, groups) created by a component
*
* @return Stream of {@link Capability} objects describing what is created
*/
Stream creates();
/**
* Helper method for filtering {@link #creates()} to a specific type of Capability
*
* @param type The type of capability to filter to
* @param Class extending Capability
* @return Stream of {@link Capability} objects describing what is created
*/
default Stream creates(Class type) {
return creates().filter(c -> type.isAssignableFrom(c.getClass())).map(type::cast);
}
/**
* Describes the things (e.g. content, annotations, groups) processed by a component
*
* @return Stream of {@link Capability} objects describing what is processed
*/
Stream processes();
/**
* Helper method for filtering {@link #processes()} to a specific type of Capability
*
* @param type The type of capability to filter to
* @param Class extending Capability
* @return Stream of {@link Capability} objects describing what is processed
*/
default Stream processes(Class type) {
return processes().filter(c -> type.isAssignableFrom(c.getClass())).map(type::cast);
}
/**
* Describes the things (e.g. content, annotations, groups) deleted by a component
*
* @return Stream of {@link Capability} objects describing what is deleted
*/
Stream deletes();
/**
* Helper method for filtering {@link #deletes()} to a specific type of Capability
*
* @param type The type of capability to filter to
* @param Class extending Capability
* @return Stream of {@link Capability} objects describing what is deleted
*/
default Stream deletes(Class type) {
return deletes().filter(c -> type.isAssignableFrom(c.getClass())).map(type::cast);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy