Package org.openmuc.eebus.spine.impl
Class FeatureBuilder
- java.lang.Object
-
- org.openmuc.eebus.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 FeatureBuilder
addFunction(FeatureFunction function)
EntityBuilder
apply()
Builds this feature and adds it to the parent entity.Feature
build()
Builds the SPINE feature.FeatureBuilder
setDescription(java.lang.String description)
FeatureBuilder
setFeatureGroup(java.lang.String group)
FeatureBuilder
setFeaturePermission(FeaturePermission featurePermission)
Sets the permissions required to access, bind to and subscribe to the new SPINE feature.FeatureBuilder
setLabel(java.lang.String label)
FeatureBuilder
setMinimumTrustLevel(java.lang.String minimumTrustLevel)
FeatureBuilder
setRole(org.eebus.docs.spine.xsd.v1.RoleType role)
FeatureBuilder
setType(org.eebus.docs.spine.xsd.v1.FeatureTypeEnumType featureType)
-
-
-
Method Detail
-
setType
public FeatureBuilder setType(org.eebus.docs.spine.xsd.v1.FeatureTypeEnumType featureType)
- Parameters:
featureType
- the type of the SPINE feature- Returns:
- the updated
FeatureBuilder
-
setRole
public FeatureBuilder setRole(org.eebus.docs.spine.xsd.v1.RoleType role)
- Parameters:
role
-SERVER
if this feature offers SPINE functions,CLIENT
if this feature uses other features' functions,SPECIAL
if 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.
If this FeatureBuilder was not created byEntityBuilder.addFeature()
this throws aUnsupportedOperationException
.
If mandatory information was not set (setType(FeatureTypeEnumType)
,setRole(RoleType)
) this operation throws anIncompleteBuildException
.- Returns:
- the updated parent
EntityBuilder
- Throws:
IncompleteBuildException
- when role and/or feature type was not set
-
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
-
-