Package org.jboss.forge.addon.configuration.facets

Examples of org.jboss.forge.addon.configuration.facets.ConfigurationFacet


   @Test
   public void testProjectFacet() throws Exception
   {
      Project project = projectFactory.createTempProject();
      assertTrue(project.hasFacet(ConfigurationFacet.class));
      ConfigurationFacet facet = project.getFacet(ConfigurationFacet.class);
      assertFalse(facet.getConfigLocation().exists());
      Configuration config = facet.getConfiguration();
      config.setProperty("key", "value");
      assertEquals("value", config.getString("key"));
      assertTrue(facet.getConfigLocation().exists());
   }
View Full Code Here


   *          The type of the returned value.
   * @return The value associated with the given {@link ProjectProperty}, or
   *         null if none exists.
   */
  public <T> T getProjectProperty(final ProjectProperty property, final Class<T> type) {
    final ConfigurationFacet config = project.getFacet(ConfigurationFacet.class);
    final Object rawPropertyValue = config.getConfiguration().getProperty(getProjectAttribute(property));

    if (rawPropertyValue != null) {
      if (!type.equals(property.valueType))
        throw new RuntimeException(String.format("Expected type %s for property %s. Found type %s.",
                property.valueType, property.name(), type));
View Full Code Here

  }

  @Override
  public boolean uninstall() {
    if (isInstalled()) {
      final ConfigurationFacet configFacet = project.getFacet(ConfigurationFacet.class);
      final Configuration config = configFacet.getConfiguration();

      for (final ProjectProperty property : Arrays.asList(ProjectProperty.values())) {
        if (config.containsKey(getProjectAttribute(property))) {
          config.clearProperty(getProjectAttribute(property));
        }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.configuration.facets.ConfigurationFacet

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.