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

com.yomahub.liteflow.spi.holder.PathContentParserHolder Maven / Gradle / Ivy

The newest version!
package com.yomahub.liteflow.spi.holder;

import cn.hutool.core.util.ObjectUtil;
import com.yomahub.liteflow.spi.PathContentParser;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.ServiceLoader;

public class PathContentParserHolder {

	private static PathContentParser pathContentParser;

	public static PathContentParser loadContextAware() {
		if (ObjectUtil.isNull(pathContentParser)) {
			List list = new ArrayList<>();
			ServiceLoader.load(PathContentParser.class).forEach(list::add);
			list.sort(Comparator.comparingInt(PathContentParser::priority));
			pathContentParser = list.get(0);
		}
		return pathContentParser;
	}

	public static void clean() {
		pathContentParser = null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy