Package br.gov.frameworkdemoiselle.configuration

Examples of br.gov.frameworkdemoiselle.configuration.ConfigurationException


    }
  }

  private void validate(Field field, String key, Object value, String resource) {
    if (field.isAnnotationPresent(NotNull.class) && value == null) {
      throw new ConfigurationException(getBundle().getString("configuration-attribute-is-mandatory", key,
          resource));
    }
  }
View Full Code Here


  private String getKeyByAnnotation(Field field) {
    String key = null;

    Name nameAnnotation = field.getAnnotation(Name.class);
    if (Strings.isEmpty(nameAnnotation.value())) {
      throw new ConfigurationException(getBundle().getString("configuration-name-attribute-cant-be-empty"));
    } else {
      key = nameAnnotation.value();
    }

    return key;
View Full Code Here

    }

    if (matches == 0) {
      getLogger().debug(getBundle().getString("configuration-key-not-found", key, conventions));
    } else if (matches > 1) {
      throw new ConfigurationException(getBundle().getString("ambiguous-key", field.getName(),
          field.getDeclaringClass()));
    }

    return key;
  }
View Full Code Here

          }

          break;

        default:
          throw new ConfigurationException(getBundle().getString("configuration-type-not-implemented-yet",
              type.name()));
      }

    } catch (Exception cause) {
      throw new ConfigurationException(getBundle().getString("error-creating-configuration-from-resource",
          resource), cause);
    }

    return result;
  }
View Full Code Here

      method = config.getClass().getMethod(methodName, String.class);
      value = method.invoke(config, key);

    } catch (Throwable cause) {
      throw new ConfigurationException(getBundle().getString("error-converting-to-type", fieldClass.getName()),
          cause);
    }

    return value;
  }
View Full Code Here

        method = config.getClass().getMethod(methodName, String.class);
        value = method.invoke(config, key);
      }

    } catch (Throwable cause) {
      throw new ConfigurationException(getBundle().getString("error-converting-to-type", fieldClass.getName()),
          cause);
    }

    return value;
  }
View Full Code Here

        value = Class.forName(canonicalName, true, classLoader);
      }

    } catch (Exception cause) {
      // TODO Lançar a mensagem correta
      throw new ConfigurationException(null, cause);
    }

    return value;
  }
View Full Code Here

    }
  }

  private void validate(Field field, String key, Object value, String resource) {
    if (field.isAnnotationPresent(NotNull.class) && value == null) {
      throw new ConfigurationException(getBundle().getString("configuration-attribute-is-mandatory", key,
          resource));
    }
  }
View Full Code Here

  private String getKeyByAnnotation(Field field) {
    String key = null;

    Name nameAnnotation = field.getAnnotation(Name.class);
    if (Strings.isEmpty(nameAnnotation.value())) {
      throw new ConfigurationException(getBundle().getString("configuration-name-attribute-cant-be-empty"));
    } else {
      key = nameAnnotation.value();
    }

    return key;
View Full Code Here

    }

    if (matches == 0) {
      getLogger().debug(getBundle().getString("configuration-key-not-found", key, conventions));
    } else if (matches > 1) {
      throw new ConfigurationException(getBundle().getString("ambiguous-key", field.getName(),
          field.getDeclaringClass()));
    }

    return key;
  }
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.configuration.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.