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

com.github.datalking.common.env.EnumerablePropertySource Maven / Gradle / Ivy

The newest version!
package com.github.datalking.common.env;

import com.github.datalking.util.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author yaoo on 5/28/18
 */
public abstract class EnumerablePropertySource extends PropertySource {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    public EnumerablePropertySource(String name, T source) {
        super(name, source);
    }

    protected EnumerablePropertySource(String name) {
        super(name);
    }

    public boolean containsProperty(String name) {
        Assert.notNull(name, "Property name must not be null");
        for (String candidate : getPropertyNames()) {
            if (candidate.equals(name)) {

                return true;
            }
        }

        return false;
    }

    public abstract String[] getPropertyNames();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy