org.javers.repository.jql.ClassFilter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javers-core Show documentation
Show all versions of javers-core Show documentation
JaVers - object auditing and diff framework for Java
package org.javers.repository.jql;
import org.javers.common.collections.Sets;
import org.javers.common.string.ToStringBuilder;
import org.javers.common.validation.Validate;
import org.javers.core.metamodel.object.GlobalId;
import org.javers.core.metamodel.type.ManagedType;
import java.util.Set;
/**
* @author bartosz.walacik
*/
class ClassFilter extends Filter {
private final Set managedTypes;
public ClassFilter(Set managedTypes) {
Validate.argumentIsNotNull(managedTypes);
this.managedTypes = managedTypes;
}
Set getManagedTypes() {
return managedTypes;
}
@Override
public String toString() {
return ToStringBuilder.toString(this, "types",
Sets.transform(managedTypes, t -> t.getName()));
}
@Override
boolean matches(GlobalId globalId) {
return managedTypes.stream().anyMatch(id -> id.getName().equals(globalId.getTypeName()));
}
}