Package io.openems.common.types
Class EdgeConfig.Factory
java.lang.Object
io.openems.common.types.EdgeConfig.Factory
- Enclosing class:
- EdgeConfig
Represents an OpenEMS Component Factory.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a configuration option of an OpenEMS Component Factory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EdgeConfig.Factory
Creates aEdgeConfig.Factory
from anObjectClassDefinition
.static EdgeConfig.Factory
Creates a Factory from JSON.Gets the Description of theEdgeConfig.Factory
.getId()
Gets the ID of theEdgeConfig.Factory
.getName()
Gets the Name of theEdgeConfig.Factory
.String[]
Gets the Nature-IDs of theEdgeConfig.Factory
.Gets theEdgeConfig.Factory.Property
s of theEdgeConfig.Factory
.getProperty
(String key) Gets the Property with the given key.com.google.gson.JsonElement
getPropertyDefaultValue
(String propertyId) Gets the default value of a property.com.google.gson.JsonObject
toJson()
Returns the Factory configuration as a JSON Object.static List<EdgeConfig.Factory.Property>
toProperties
(org.osgi.service.metatype.ObjectClassDefinition ocd) Parses aObjectClassDefinition
to a list ofEdgeConfig.Factory.Property
s.
-
Constructor Details
-
Factory
public Factory(String id, String name, String description, EdgeConfig.Factory.Property[] properties, String[] natureIds)
-
-
Method Details
-
create
public static EdgeConfig.Factory create(String factoryId, org.osgi.service.metatype.ObjectClassDefinition ocd, String[] natureIds) Creates aEdgeConfig.Factory
from anObjectClassDefinition
.- Parameters:
factoryId
- the Factory-IDocd
- theObjectClassDefinition
natureIds
- the Nature-IDs- Returns:
- a
EdgeConfig.Factory
-
toProperties
public static List<EdgeConfig.Factory.Property> toProperties(org.osgi.service.metatype.ObjectClassDefinition ocd) Parses aObjectClassDefinition
to a list ofEdgeConfig.Factory.Property
s.- Parameters:
ocd
- theObjectClassDefinition
- Returns:
- a list of
EdgeConfig.Factory.Property
s
-
getId
Gets the ID of theEdgeConfig.Factory
.- Returns:
- the ID
-
getName
Gets the Name of theEdgeConfig.Factory
.- Returns:
- the name
-
getDescription
Gets the Description of theEdgeConfig.Factory
.- Returns:
- the description
-
getProperties
Gets theEdgeConfig.Factory.Property
s of theEdgeConfig.Factory
.- Returns:
- an array of
EdgeConfig.Factory.Property
s
-
getProperty
Gets the Property with the given key.- Parameters:
key
- the property key- Returns:
- the Property
-
getPropertyDefaultValue
Gets the default value of a property.- Parameters:
propertyId
- the Property ID- Returns:
- the default value as
JsonElement
-
getNatureIds
Gets the Nature-IDs of theEdgeConfig.Factory
.- Returns:
- the Nature-IDs
-
toJson
public com.google.gson.JsonObject toJson()Returns the Factory configuration as a JSON Object.{ natureIds: string[] }
- Returns:
- configuration as a JSON Object
-
fromJson
public static EdgeConfig.Factory fromJson(String factoryId, com.google.gson.JsonElement json) throws OpenemsError.OpenemsNamedException Creates a Factory from JSON.- Parameters:
factoryId
- the Factory-IDjson
- the JSON- Returns:
- the Factory
- Throws:
OpenemsError.OpenemsNamedException
- on error
-