All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nitorcreations.willow.deployer.statistics.AbstractChildStatisticsSender Maven / Gradle / Ivy

The newest version!
package com.nitorcreations.willow.deployer.statistics;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

import javax.inject.Inject;

import com.nitorcreations.willow.deployer.Main;

public abstract class AbstractChildStatisticsSender extends AbstractStatisticsSender {
  @Inject
  protected Main main;
  protected List configuredChildren = new ArrayList();

  @Override
  public void setProperties(Properties properties) {
    String nextChild = properties.getProperty("children[0]");
    int i = 0;
    while (nextChild != null) {
      configuredChildren.add(nextChild);
      nextChild = properties.getProperty("children[" + ++i + "]");
    }
  }
  protected List getChildren() {
    if (configuredChildren.isEmpty()) {
      return Arrays.asList(main.getChildNames());
    } else {
      return Collections.unmodifiableList(configuredChildren);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy