code: public void addAttribute(final IAttributeBehavior behavior) throws DevFailed {
          final AttributeConfiguration configuration = behavior.getConfiguration();
          final String attributeName = configuration.getName();
          xlogger.entry("adding dynamic attribute {}", attributeName);
          if (behavior instanceof ForwardedAttribute) {
              // init attribute with either the attribute property value, or the value defined in its constructor
              final ForwardedAttribute att = (ForwardedAttribute) behavior;
              final String deviceName = deviceImpl.getName();
              final String rootAttributeName = behavior.getConfiguration().getAttributeProperties()
                      .loadAttributeRootName(deviceName, attributeName);
              if (rootAttributeName == null || rootAttributeName.isEmpty()
                      || rootAttributeName.equalsIgnoreCase(Constants.NOT_SPECIFIED)) {
                  att.init(deviceName);
                  // persist root attribute name in tango db
                  behavior.getConfiguration().getAttributeProperties()
                          .persistAttributeRootName(deviceName, attributeName);
              } else {
                  // use attribute property
                  att.init(deviceName, rootAttributeName);
              }
              // check if this attribute is already created
              final String lower = att.getRootName().toLowerCase(Locale.ENGLISH);
              if (forwardedAttributes.contains(lower)) {
                  throw DevFailedUtils.newDevFailed(ExceptionMessages.FWD_DOUBLE_USED,
                          "root attribute already used in this device");
              } else {
                  forwardedAttributes.add(lower);
              }
          } else {
              // set default properties
              final AttributePropertiesImpl prop = configuration.getAttributeProperties();
              if (prop.getLabel().isEmpty()) {
                  prop.setLabel(configuration.getName());
              }
              if (prop.getFormat().equals(Constants.NOT_SPECIFIED)) {
                  prop.setDefaultFormat(configuration.getScalarType());
              }
          }
          final AttributeImpl attrImpl = new AttributeImpl(behavior, deviceImpl.getName());
          attrImpl.setStateMachine(behavior.getStateMachine());
          deviceImpl.addAttribute(attrImpl);
          dynamicAttributes.put(attributeName.toLowerCase(Locale.ENGLISH), attrImpl);
          deviceImpl.pushInterfaceChangeEvent(false);
          if (configuration.isPolled() && configuration.getPollingPeriod() > 0) {
              deviceImpl.addAttributePolling(attributeName, configuration.getPollingPeriod());
          }
          xlogger.exit();
      }
docs: Add attribute. Only if not already exists on device.
  
  @param behavior
  @throws DevFailed