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

com.github.ldeitos.validators.util.NodeBuilderDefinedContextAdapter Maven / Gradle / Ivy

package com.github.ldeitos.validators.util;

import jakarta.validation.ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext;
import jakarta.validation.ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderDefinedContext;

public class NodeBuilderDefinedContextAdapter implements ConstraintBuilderAdapter {
	private NodeBuilderDefinedContext nBuilder;

	private NodeBuilderCustomizableContext nbCustonCtxt;

	public NodeBuilderDefinedContextAdapter(NodeBuilderDefinedContext nBuilder) {
		this.nBuilder = nBuilder;
	}

	@Override
	public ConstraintBuilderAdapter addPropertyNode(Path path) {
		nbCustonCtxt = nBuilder.addPropertyNode(path.getPath());
		return new NodeBuilderCustomizableContextAdapter(nbCustonCtxt);
	}

	@Override
	public void addConstraintViolation() {
		if (nbCustonCtxt != null) {
			nbCustonCtxt.addConstraintViolation();
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy