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

com.github.zhengframework.configuration.parser.FileConfigurationParser Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.github.zhengframework.configuration.parser;

import java.io.InputStream;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.ArrayUtils;

public interface FileConfigurationParser {

  String[] supportFileTypes();

  Map parse(String fileName, InputStream inputStream);

  default void checkSupportFileTypes(String fileName) {
    String s = Objects.requireNonNull(fileName);
    String type = s.substring(s.lastIndexOf("."));
    if (!ArrayUtils.contains(supportFileTypes(), type)) {
      throw new IllegalStateException("not support file type: " + type);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy