Package org.openmuc.jeebus.spine.impl
Class FeatureBuilder
- java.lang.Object
-
- org.openmuc.jeebus.spine.impl.FeatureBuilder
-
public class FeatureBuilder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FeatureBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeatureBuilderaddFunction(FeatureFunction function)EntityBuilderapply()Builds this feature and adds it to the parent entity.Featurebuild()Builds the SPINE feature.FeatureBuildersetDescription(java.lang.String description)FeatureBuildersetFeatureGroup(java.lang.String group)FeatureBuildersetFeaturePermission(FeaturePermission featurePermission)Sets the permissions required to access, bind to and subscribe to the new SPINE feature.FeatureBuildersetLabel(java.lang.String label)FeatureBuildersetMinimumTrustLevel(java.lang.String minimumTrustLevel)FeatureBuildersetRole(org.openmuc.jeebus.spine.xsd.v1.RoleType role)FeatureBuildersetType(org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType)
-
-
-
Method Detail
-
setType
public FeatureBuilder setType(org.openmuc.jeebus.spine.xsd.v1.FeatureTypeEnumType featureType)
- Parameters:
featureType- the type of the SPINE feature- Returns:
- the updated
FeatureBuilder
-
setRole
public FeatureBuilder setRole(org.openmuc.jeebus.spine.xsd.v1.RoleType role)
- Parameters:
role-SERVERif this feature offers SPINE functions,CLIENTif this feature uses other features' functions,SPECIALif both- Returns:
- the updated
FeatureBuilder
-
addFunction
public FeatureBuilder addFunction(FeatureFunction function)
- Parameters:
function- the SPINE function to add- Returns:
- the updated
FeatureBuilder
-
setDescription
public FeatureBuilder setDescription(java.lang.String description)
- Parameters:
description- a string describing the new SPINE feature- Returns:
- the updated
FeatureBuilder
-
setLabel
public FeatureBuilder setLabel(java.lang.String label)
- Parameters:
label- a human-readable alias of the new SPINE feature- Returns:
- the updated
FeatureBuilder
-
setFeatureGroup
public FeatureBuilder setFeatureGroup(java.lang.String group)
- Parameters:
group- the group this feature belongs to- Returns:
- the updated
FeatureBuilder - Throws:
java.lang.IllegalArgumentException- if group does not match pattern(#[1-9][0-9]*)*
-
setMinimumTrustLevel
public FeatureBuilder setMinimumTrustLevel(java.lang.String minimumTrustLevel)
- Parameters:
minimumTrustLevel- the minimum trust level needed to access the feature- Returns:
- the updated
FeatureBuilder
-
setFeaturePermission
public FeatureBuilder setFeaturePermission(FeaturePermission featurePermission)
Sets the permissions required to access, bind to and subscribe to the new SPINE feature.- Parameters:
featurePermission- the rules for binding and subscription requests- Returns:
- the updated
FeatureBuilder
-
apply
public EntityBuilder apply() throws IncompleteBuildException
Builds this feature and adds it to the parent entity.- Returns:
- the updated parent
EntityBuilder - Throws:
IncompleteBuildException- If mandatory information was not set (setType(FeatureTypeEnumType),setRole(RoleType))java.lang.UnsupportedOperationException- If this FeatureBuilder was not created byEntityBuilder.addFeature()
-
build
public Feature build() throws IncompleteBuildException
Builds the SPINE feature. The new feature can then be added to a SPINE entity at runtime withEntity.addFeature(Feature)
If mandatory information was not set (setType(FeatureTypeEnumType),setRole(RoleType)) this operation throws anIncompleteBuildException.- Returns:
- the built SPINE feature
- Throws:
IncompleteBuildException- when the feature type and/or role was not set
-
-