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

org.hibernate.search.engine.spi.ContainedInRecursionContext Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.search.engine.spi;

import java.util.Set;

/**
 * Used to check the constraints of depth when using {@link org.hibernate.search.annotations.IndexedEmbedded}
 * or {@link org.hibernate.search.annotations.ContainedIn} annotations.
 *
 * @author Davide D'Alto
 * @author Yoann Rodiere
 */
public class ContainedInRecursionContext {

	private final int maxDepth;
	private final int depth;
	private final Set comprehensivePaths;

	public ContainedInRecursionContext(int maxDepth, int depth, Set comprehensivePaths) {
		this.maxDepth = maxDepth;
		this.depth = depth;
		this.comprehensivePaths = comprehensivePaths;
	}

	public int getMaxDepth() {
		return maxDepth;
	}

	public int getDepth() {
		return depth;
	}

	public Set getComprehensivePaths() {
		return comprehensivePaths;
	}

	public boolean isTerminal() {
		return depth > maxDepth || comprehensivePaths != null && comprehensivePaths.isEmpty();
	}

	@Override
	public String toString() {
		return "[maxDepth=" + maxDepth + ", level=" + depth + ", comprehensivePaths=" + comprehensivePaths + "]";
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy