-
- All Superinterfaces:
WithFilter<Content<?>>,WithGroups,WithId,WithMutableProperties
public interface Item extends WithId, WithMutableProperties, WithGroups, WithFilter<Content<?>>
Item interface used by components.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ItemcreateChild()Create a child item of this item, which will be processed independently<C extends Content<D>,D>
Content.Builder<C,D>createContent(Class<C> clazz)Create a new content builder to generate content.voiddiscard()Stop processing this item any further.default Stream<Content<?>>filter(Filter<Content<?>> filter)Filter content to match the test.Optional<Content<?>>getContent(String id)The content object for the specified idStream<Content<?>>getContents()All content objects contained within this itemdefault <T extends Content<?>>
Stream<T>getContents(Class<T> clazz)All content objects of the specified class contained within this itemOptional<String>getParent()Get id of parentdefault booleanhasParent()Does this item have a parent?booleanisDiscarded()If this item is to be discarded at the end of current processingdefault voidremoveContent(Content<?> content)Remove the specified content object from this itemvoidremoveContent(String id)Remove the specified content object from this item-
Methods inherited from interface io.annot8.api.helpers.WithFilter
find
-
Methods inherited from interface io.annot8.api.helpers.WithGroups
getGroups
-
Methods inherited from interface io.annot8.api.helpers.WithMutableProperties
getProperties
-
-
-
-
Method Detail
-
hasParent
default boolean hasParent()
Does this item have a parent?- Returns:
- true if has a parent.
-
getContent
Optional<Content<?>> getContent(String id)
The content object for the specified id- Parameters:
id- the content id- Returns:
- the content if it exists
-
getContents
Stream<Content<?>> getContents()
All content objects contained within this item- Returns:
- all content
-
filter
default Stream<Content<?>> filter(Filter<Content<?>> filter)
Filter content to match the test.- Specified by:
filterin interfaceWithFilter<Content<?>>- Parameters:
filter- the test to filter with- Returns:
- stream of matching annotations
-
getContents
default <T extends Content<?>> Stream<T> getContents(Class<T> clazz)
All content objects of the specified class contained within this item- Type Parameters:
T- the content class- Parameters:
clazz- the content class to filter against- Returns:
- content
-
createContent
<C extends Content<D>,D> Content.Builder<C,D> createContent(Class<C> clazz)
Create a new content builder to generate content.- Type Parameters:
C- the content classD- the data class- Parameters:
clazz- the top level content type required- Returns:
- content builder
- Throws:
UnsupportedContentException- if the clazz can't be created
-
removeContent
void removeContent(String id)
Remove the specified content object from this item- Parameters:
id- the content id
-
removeContent
default void removeContent(Content<?> content)
Remove the specified content object from this item- Parameters:
content- the content
-
discard
void discard()
Stop processing this item any further.Note that it is up to the underlying implementation as to whether they delete existing output from this item or not.
-
isDiscarded
boolean isDiscarded()
If this item is to be discarded at the end of current processing- Returns:
- true if discarded
-
createChild
Item createChild()
Create a child item of this item, which will be processed independently- Returns:
- new item, with this item as its parent
-
-