Package br.gov.frameworkdemoiselle.configuration

Examples of br.gov.frameworkdemoiselle.configuration.ConfigurationException


        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


    }
  }

  private void validate(Field field, Key key, Object value, String resource) {
    if (field.isAnnotationPresent(NotNull.class) && value == null) {
      throw new ConfigurationException(getBundle().getString("configuration-attribute-is-mandatory",
          key.toString(), resource));
    }
  }
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.toString());

    } 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.toString());
      }

    } 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 String getNameByAnnotation(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

  private void validateField(Field field) {
    Name annotation = field.getAnnotation(Name.class);

    if (annotation != null && Strings.isEmpty(annotation.value())) {
      throw new ConfigurationException(getBundle().getString("configuration-name-attribute-cant-be-empty"),
          new IllegalArgumentException());
    }
  }
View Full Code Here

    } catch (ConfigurationException cause) {
      throw cause;

    } catch (ConversionException cause) {
      throw new ConfigurationException(getBundle().getString("configuration-not-conversion",
          this.prefix + getKey(field), field.getType().toString()), cause);
    }

    catch (Exception cause) {
      // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal.
      throw new ConfigurationException("", cause);
    }

    return value;
  }
View Full Code Here

    ConfigurationValueExtractor elected = StrategySelector.selectInstance(ConfigurationValueExtractor.class,
        candidates);

    if (elected == null) {
      throw new ConfigurationException(getBundle().getString("configuration-extractor-not-found",
          field.toGenericString(), ConfigurationValueExtractor.class.getName()), new ClassNotFoundException());
    }

    return elected;
  }
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.