Esempio n. 1
0
  private Hashtable<FieldCmdKind, Object> InitValuesFieldForCmd() {
    Hashtable<FieldCmdKind, Object> fieldsValue =
        new Hashtable<>(); // Набор пар видов полей и значений для них.

    fieldsValue.put(STACK, dataStack); // Стек значений
    fieldsValue.put(CONTEXT, dictionaryDefine); // Словарь замен.

    return fieldsValue;
  }
Esempio n. 2
0
  private void outContextInLog() {
    if (log.isDebugEnabled()) {
      StringBuilder outStr = new StringBuilder();

      if (dictionaryDefine != null)
        for (Map.Entry<String, Double> iDictionary : dictionaryDefine.entrySet()) {
          // outStr.append(iDictionary.getKey() + " = " + iDictionary.getValue() + ";  ");
          outStr.append(iDictionary.getKey());
          outStr.append(" = ");
          outStr.append(iDictionary.getValue());
          outStr.append(";  ");
        }
      else outStr.append("Context is null.");

      if (outStr.length() == 0) outStr.append("Context is empty.");

      log.debug(String.valueOf(outStr));
    }
  }
Esempio n. 3
0
  private void setFieldValue(Field f, Object obj, Hashtable<FieldCmdKind, Object> fieldsValue) {
    FieldCmd annotationField; // Аннотация описывающая тип поля.
    Object value; // Значение устанавливаемое полю (в зависимости от типа поля).

    f.setAccessible(true);
    annotationField = f.getAnnotation(FieldCmd.class);

    if (annotationField != null) {
      value = fieldsValue.get(annotationField.fieldType());

      if (value != null) {
        try {
          f.set(obj, value);
        } catch (IllegalAccessException e) {
          log.error(
              "Ошибка при устрановлении полю \""
                  + f.getName()
                  + "\" ссылки по установленному типу \""
                  + annotationField.fieldType()
                  + "\".");
        }
      }
    }
  }