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

org.unlaxer.ParserNameContext Maven / Gradle / Ivy

package org.unlaxer;

import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.unlaxer.parser.Parser;

public class ParserNameContext{
	
	Map parserByName;

	public ParserNameContext(Parser rootParser) {
		super();
		parserByName = rootParser.flatten().parallelStream()
			.collect(Collectors.toMap(Parser::getName, Function.identity()));
	}
	
	public Optional get(Name name){
		return Optional.ofNullable(parserByName.get(name));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy