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

com.metreeca.mark.File Maven / Gradle / Ivy

/*
 * Copyright © 2019-2023 Metreeca srl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.metreeca.mark;

import java.nio.file.Path;
import java.util.Map;
import java.util.function.BiConsumer;

import static java.util.Collections.unmodifiableMap;

/**
 * Site file.
 */
public final class File {

	private final Path path;
	private final Map model;
	private final BiConsumer> processor;


	/**
	 * @param path
	 * @param model     may be extended
	 * @param processor
	 */
	public File(final Path path, final Map model,
			final BiConsumer> processor
	) {

		if ( path == null ) {
			throw new NullPointerException("null path");
		}

		if ( model == null ) {
			throw new NullPointerException("null model");
		}

		if ( processor == null ) {
			throw new NullPointerException("null processor");
		}

		this.path=path;
		this.model=unmodifiableMap(model);
		this.processor=processor;
	}


	public Path path() {
		return path;
	}

	public Map model() {
		return model;
	}

	public BiConsumer> process() {
		return processor;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy