Package org.openmuc.eebus.spine.impl
Class EntityBuilder
- java.lang.Object
-
- org.openmuc.eebus.spine.impl.EntityBuilder
-
public class EntityBuilder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description EntityBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityBuilder
addEntity()
Creates a new EntityBuilder instance.FeatureBuilder
addFeature()
Creates a new FeatureBuilder instance.EntityBuilder
addUseCase(UseCase useCase)
DeviceBuilder
applyToDevice()
Builds this entity and adds it to the parent device.EntityBuilder
applyToEntity()
Builds this entity and adds it to the parent entity.Entity
build()
Builds the SPINE entity.EntityBuilder
setDescription(java.lang.String description)
EntityBuilder
setLabel(java.lang.String label)
EntityBuilder
setType(org.eebus.docs.spine.xsd.v1.EntityTypeEnumType entityType)
-
-
-
Method Detail
-
setType
public EntityBuilder setType(org.eebus.docs.spine.xsd.v1.EntityTypeEnumType entityType)
- Parameters:
entityType
- the type of the SPINE entity- Returns:
- the updated
EntityBuilder
-
addEntity
public EntityBuilder addEntity()
Creates a new EntityBuilder instance. The sub-entity can then be fluently added to this entity withapplyToEntity()
- Returns:
- a new EntityBuilder instance
-
addFeature
public FeatureBuilder addFeature()
Creates a new FeatureBuilder instance. The feature can then be fluently added to this entity withFeatureBuilder.apply()
.- Returns:
- a new FeatureBuilder instance
-
setDescription
public EntityBuilder setDescription(java.lang.String description)
- Parameters:
description
- a string describing the new SPINE entity- Returns:
- the updated
EntityBuilder
-
setLabel
public EntityBuilder setLabel(java.lang.String label)
- Parameters:
label
- a human-readable alias of the new SPINE entity- Returns:
- the updated
EntityBuilder
-
applyToEntity
public EntityBuilder applyToEntity()
Builds this entity and adds it to the parent entity.
If this EntityBuilder was not created from another EntityBuilder this throwsUnsupportedOperationException
.
If mandatory information was not set (setType(EntityTypeEnumType)
) this operation throws anIncompleteBuildException
.- Returns:
- the updated parent
EntityBuilder
-
applyToDevice
public DeviceBuilder applyToDevice()
Builds this entity and adds it to the parent device.
If this EntityBuilder was not created from a DeviceBuilder this throwsUnsupportedOperationException
.
If mandatory information was not set (setType(EntityTypeEnumType)
) this operation throws anIncompleteBuildException
.- Returns:
- the updated parent
DeviceBuilder
-
addUseCase
public EntityBuilder addUseCase(UseCase useCase)
-
build
public Entity build() throws IncompleteBuildException
Builds the SPINE entity. The new entity can then be added to a SPINE device or entity at runtime withEntityParent.addEntity(Entity)
orEntityParent.addEntity(Entity)
If mandatory information was not set (setType(EntityTypeEnumType)
) this operation throws andIncompleteBuildException
.- Returns:
- the built SPINE entity
- Throws:
IncompleteBuildException
- when the entity type was not set
-
-