
org.hibernate.search.engine.metadata.impl.PathsContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-engine Show documentation
Show all versions of hibernate-search-engine Show documentation
Core of the Object/Lucene mapper, query engine and index management
/*
* 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.metadata.impl;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Container class for information about the current set of paths as
* well as tracking which paths have been encountered to validate the
* existence of all configured paths.
*/
public class PathsContext {
private final Map pathsEncounteredState = new HashMap<>();
public boolean containsPath(String path) {
return pathsEncounteredState.keySet().contains( path );
}
public void addPath(String path) {
pathsEncounteredState.put( path, Boolean.FALSE );
}
public void markEncounteredPath(String path) {
pathsEncounteredState.put( path, Boolean.TRUE );
}
public Set getEncounteredPaths() {
return pathsEncounteredState.keySet();
}
public Set getUnEncounteredPaths() {
Set unEncounteredPaths = new HashSet<>();
for ( String path : pathsEncounteredState.keySet() ) {
if ( notEncountered( path ) ) {
unEncounteredPaths.add( path );
}
}
return unEncounteredPaths;
}
private boolean notEncountered(String path) {
return !pathsEncounteredState.get( path );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy