Class ExpressionConfig

java.lang.Object
net.solarnetwork.domain.datum.DatumSamplePropertyConfig<String>
net.solarnetwork.node.service.support.ExpressionConfig

public class ExpressionConfig extends net.solarnetwork.domain.datum.DatumSamplePropertyConfig<String>
Configuration for a single datum property to be set via an expression.

The DatumSamplePropertyConfig.getConfig() value represents the expression to evaluate.

Since:
1.79
Version:
2.0
Author:
matt
  • Constructor Details

    • ExpressionConfig

      public ExpressionConfig()
      Default constructor.
    • ExpressionConfig

      public ExpressionConfig(String name, net.solarnetwork.domain.datum.DatumSamplesType propertyType, String expression, String expressionServiceId)
      Construct with values.
      Parameters:
      name - the datum property name
      propertyType - the datum property type
      expression - the expression
      expressionServiceId - the expression service ID
  • Method Details

    • settings

      public static List<net.solarnetwork.settings.SettingSpecifier> settings(Class<?> clazz, String prefix, Iterable<net.solarnetwork.service.ExpressionService> expressionServices)
      Get settings suitable for configuring an instance of this class.
      Parameters:
      clazz - the class to get the relative ExpressionConfig.properties resource from
      prefix - a setting key prefix to use
      expressionServices - the available expression services
      Returns:
      the settings, never null
    • toSettingValues

      public List<SettingValueBean> toSettingValues(String providerId, String instanceId, String prefix)
      Generate a list of setting values from this instance.
      Parameters:
      providerId - the setting provider key to use
      instanceId - the setting provider instance key to use
      prefix - a prefix to append to all setting keys
      Returns:
      the list of setting values, never null
      Since:
      1.1
    • expressionReferenceLink

      public static URI expressionReferenceLink(Class<?> clazz)
      Get a link to an expression service guide.
      Parameters:
      clazz - the class to get the relative ExpressionConfig.properties resource from
      Returns:
      a link to an expression guide
    • getExpression

      public net.solarnetwork.service.support.ExpressionServiceExpression getExpression(Iterable<net.solarnetwork.service.ExpressionService> services)
      Get the appropriate Expression to use for this property configuration, if an expression is configured and the appropriate service is available.
      Parameters:
      services - the available services
      Returns:
      the expression instance, or null if no expression configured or the appropriate service is not found
      Since:
      1.1
    • getName

      public String getName()
      Get the datum property name used for this configuration.

      This is an alias for DatumSamplePropertyConfig.getPropertyKey().

      Returns:
      the property name
    • setName

      public void setName(String name)
      Set the datum property name to use.

      This is an alias for DatumSamplePropertyConfig.setPropertyKey(String).

      Parameters:
      name - the property name
    • getExpression

      public String getExpression()
      Get the expression.

      This is an alias for DatumSamplePropertyConfig.getConfig().

      Returns:
      the expression
    • setExpression

      public void setExpression(String expression)
      Set the expression.

      This is an alias for DatumSamplePropertyConfig.setConfig(Object).

      Parameters:
      expression - the expression to set
    • getExpressionServiceId

      public String getExpressionServiceId()
      Get the ExpressionService ID to use when evaluating getExpression().
      Returns:
      the service ID
    • setExpressionServiceId

      public void setExpressionServiceId(String expressionServiceId)
      Set the ExpressionService ID to use when evaluating getExpression().
      Parameters:
      expressionServiceId - the service ID, or null to not evaluate
    • getDatumPropertyType

      public net.solarnetwork.domain.datum.DatumSamplesType getDatumPropertyType()
      Get the datum property type.

      This is an alias for DatumSamplePropertyConfig.getPropertyType().

      Returns:
      the type
    • setDatumPropertyType

      public void setDatumPropertyType(net.solarnetwork.domain.datum.DatumSamplesType datumPropertyType)
      Set the datum property type.

      This is an alias for DatumSamplePropertyConfig.setPropertyType(DatumSamplesType), and ignores a null argument.

      Parameters:
      datumPropertyType - the datum property type to set
    • getDatumPropertyTypeKey

      public String getDatumPropertyTypeKey()
      Get the property type key.

      This returns the configured DatumSamplePropertyConfig.getPropertyType() DatumSamplesType.toKey() value as a string. If the type is not available, DatumSamplesType.Instantaneous will be returned.

      Returns:
      the property type key
    • setDatumPropertyTypeKey

      public void setDatumPropertyTypeKey(String key)
      Set the property type via a key value.

      This uses the first character of key as a DatumSamplesType key value to call DatumSamplePropertyConfig.setPropertyType(DatumSamplesType). If there is any problem parsing the type, DatumSamplesType.Instantaneous is set.

      Parameters:
      key - the datum property type key to set