-
- All Superinterfaces:
WithGroups,WithId,WithMutableProperties
- All Known Subinterfaces:
Item
public interface BaseItem extends WithId, WithMutableProperties, WithGroups
Base item interface from which all item implementations extend.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <C extends Content<D>,D>
Content.Builder<C,D>create(Class<C> clazz)Create a new content builder to generate content.voiddiscard()Stop processing this item any further.Optional<Content<?>>getContent(String id)The content object for the specified iddefault Stream<Content<?>>getContentByName(String name)The content object for the specified nameStream<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()default booleanhasContentOfName(String name)Check if content name existsdefault booleanhasParent()booleanisDiscarded()If this item is to be discarded at the end of current processingdefault Stream<String>listNames()The names of the content objects currently held within this itemvoidremoveContent(String id)Remove the specified content object from this item-
Methods inherited from interface io.annot8.core.helpers.WithGroups
getGroups
-
Methods inherited from interface io.annot8.core.helpers.WithMutableProperties
getProperties
-
-
-
-
Method Detail
-
hasParent
default boolean hasParent()
-
hasContentOfName
default boolean hasContentOfName(String name)
Check if content name exists- Returns:
- true if this item has a content object with the specified name
-
listNames
default Stream<String> listNames()
The names of the content objects currently held within this item- Returns:
- content names
-
getContent
Optional<Content<?>> getContent(String id)
The content object for the specified id- Parameters:
id- the content id- Returns:
- the content if it exists
-
getContentByName
default Stream<Content<?>> getContentByName(String name)
The content object for the specified name- Parameters:
name- the content name- Returns:
- the content if it exists
-
getContents
Stream<Content<?>> getContents()
All content objects contained within this item- Returns:
- all content
-
getContents
default <T extends Content<?>> Stream<T> getContents(Class<T> clazz)
All content objects of the specified class contained within this item- Parameters:
clazz- the content class to filter against- Returns:
- content
-
create
<C extends Content<D>,D> Content.Builder<C,D> create(Class<C> clazz) throws UnsupportedContentException
Create a new content builder to generate content.- 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
-
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
-
-