code: public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject)
              throws DevFailed {
          xlogger.entry();
          BuilderUtils.checkStatic(field);
          Method getter;
          final String stateName = field.getName();
          final String getterName = BuilderUtils.GET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
                  + stateName.substring(1);
          try {
              getter = clazz.getMethod(getterName);
          } catch (final NoSuchMethodException e) {
              throw DevFailedUtils.newDevFailed(e);
          }
          if (getter.getParameterTypes().length != 0) {
              throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
          }
  
          logger.debug("Has an state : {}", field.getName());
          if (getter.getReturnType() != DeviceState.class && getter.getReturnType() != DevState.class) {
              throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of  "
                      + DeviceState.class.getCanonicalName() + " or " + DevState.class.getCanonicalName());
          }
          Method setter;
          final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
                  + stateName.substring(1);
          try {
              setter = clazz.getMethod(setterName, DeviceState.class);
          } catch (final NoSuchMethodException e) {
              try {
                  setter = clazz.getMethod(setterName, DevState.class);
              } catch (final NoSuchMethodException e1) {
                  throw DevFailedUtils.newDevFailed(e1);
              }
          }
          device.setStateImpl(new StateImpl(businessObject, getter, setter));
          final State annot = field.getAnnotation(State.class);
          if (annot.isPolled()) {
              device.addAttributePolling(DeviceImpl.STATE_NAME, annot.pollingPeriod());
          }
          xlogger.exit();
      }
docs: Create a state
  
  @param clazz
  @param field
  @param device
  @param businessObject
  @throws DevFailed