diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/AnyEvaluator.java b/src/main/java/build/buf/protovalidate/AnyEvaluator.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/evaluator/AnyEvaluator.java rename to src/main/java/build/buf/protovalidate/AnyEvaluator.java index 0a881c69..a93777ff 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/AnyEvaluator.java +++ b/src/main/java/build/buf/protovalidate/AnyEvaluator.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.AnyRules; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; diff --git a/src/main/java/build/buf/protovalidate/internal/expression/AstExpression.java b/src/main/java/build/buf/protovalidate/AstExpression.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/expression/AstExpression.java rename to src/main/java/build/buf/protovalidate/AstExpression.java index fba764b6..24cce494 100644 --- a/src/main/java/build/buf/protovalidate/internal/expression/AstExpression.java +++ b/src/main/java/build/buf/protovalidate/AstExpression.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.expression; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.CompilationException; import com.google.api.expr.v1alpha1.Type; @@ -20,7 +20,7 @@ import org.projectnessie.cel.Env; /** {@link AstExpression} is a compiled CEL {@link Ast}. */ -public class AstExpression { +class AstExpression { /** The compiled CEL AST. */ public final Ast ast; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/CelPrograms.java b/src/main/java/build/buf/protovalidate/CelPrograms.java similarity index 87% rename from src/main/java/build/buf/protovalidate/internal/evaluator/CelPrograms.java rename to src/main/java/build/buf/protovalidate/CelPrograms.java index 4927b8af..a3df4ed6 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/CelPrograms.java +++ b/src/main/java/build/buf/protovalidate/CelPrograms.java @@ -12,13 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; -import build.buf.protovalidate.internal.expression.CompiledProgram; -import build.buf.protovalidate.internal.expression.Variable; import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; diff --git a/src/main/java/build/buf/protovalidate/internal/expression/CompiledProgram.java b/src/main/java/build/buf/protovalidate/CompiledProgram.java similarity index 95% rename from src/main/java/build/buf/protovalidate/internal/expression/CompiledProgram.java rename to src/main/java/build/buf/protovalidate/CompiledProgram.java index afb594e6..fa1c68a8 100644 --- a/src/main/java/build/buf/protovalidate/internal/expression/CompiledProgram.java +++ b/src/main/java/build/buf/protovalidate/CompiledProgram.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.expression; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.evaluator.Value; import build.buf.validate.FieldPath; import javax.annotation.Nullable; import org.projectnessie.cel.Program; @@ -27,7 +25,7 @@ * {@link CompiledProgram} is a parsed and type-checked {@link Program} along with the source {@link * Expression}. */ -public class CompiledProgram { +class CompiledProgram { /** A compiled CEL program that can be evaluated against a set of variable bindings. */ private final Program program; diff --git a/src/main/java/build/buf/protovalidate/internal/constraints/ConstraintCache.java b/src/main/java/build/buf/protovalidate/ConstraintCache.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/constraints/ConstraintCache.java rename to src/main/java/build/buf/protovalidate/ConstraintCache.java index 2a4a8435..708019f2 100644 --- a/src/main/java/build/buf/protovalidate/internal/constraints/ConstraintCache.java +++ b/src/main/java/build/buf/protovalidate/ConstraintCache.java @@ -12,17 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.constraints; +package build.buf.protovalidate; -import build.buf.protovalidate.Config; import build.buf.protovalidate.exceptions.CompilationException; -import build.buf.protovalidate.internal.errors.FieldPathUtils; -import build.buf.protovalidate.internal.evaluator.ObjectValue; -import build.buf.protovalidate.internal.evaluator.Value; -import build.buf.protovalidate.internal.expression.AstExpression; -import build.buf.protovalidate.internal.expression.CompiledProgram; -import build.buf.protovalidate.internal.expression.Expression; -import build.buf.protovalidate.internal.expression.Variable; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import build.buf.validate.ValidateProto; @@ -52,7 +44,7 @@ import org.projectnessie.cel.interpreter.Activation; /** A build-through cache for computed standard constraints. */ -public class ConstraintCache { +class ConstraintCache { private static class CelRule { public final AstExpression astExpression; public final FieldDescriptor field; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintResolver.java b/src/main/java/build/buf/protovalidate/ConstraintResolver.java similarity index 99% rename from src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintResolver.java rename to src/main/java/build/buf/protovalidate/ConstraintResolver.java index b94cfb8e..ffe6bf0e 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintResolver.java +++ b/src/main/java/build/buf/protovalidate/ConstraintResolver.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.CompilationException; import build.buf.validate.FieldConstraints; diff --git a/src/main/java/build/buf/protovalidate/internal/errors/ConstraintViolation.java b/src/main/java/build/buf/protovalidate/ConstraintViolation.java similarity index 97% rename from src/main/java/build/buf/protovalidate/internal/errors/ConstraintViolation.java rename to src/main/java/build/buf/protovalidate/ConstraintViolation.java index 711b012b..3687d28a 100644 --- a/src/main/java/build/buf/protovalidate/internal/errors/ConstraintViolation.java +++ b/src/main/java/build/buf/protovalidate/ConstraintViolation.java @@ -12,10 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.errors; +package build.buf.protovalidate; -import build.buf.protovalidate.Violation; -import build.buf.protovalidate.internal.evaluator.Value; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; import com.google.protobuf.Descriptors; @@ -31,7 +29,7 @@ * {@link ConstraintViolation} contains all of the collected information about an individual * constraint violation. */ -public class ConstraintViolation implements Violation { +class ConstraintViolation implements Violation { /** Static value to return when there are no violations. */ public static final List NO_VIOLATIONS = new ArrayList<>(); diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintViolationHelper.java b/src/main/java/build/buf/protovalidate/ConstraintViolationHelper.java similarity index 94% rename from src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintViolationHelper.java rename to src/main/java/build/buf/protovalidate/ConstraintViolationHelper.java index 7abcee01..2a9b4943 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/ConstraintViolationHelper.java +++ b/src/main/java/build/buf/protovalidate/ConstraintViolationHelper.java @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; import java.util.ArrayList; diff --git a/src/main/java/build/buf/protovalidate/internal/celext/CustomDeclarations.java b/src/main/java/build/buf/protovalidate/CustomDeclarations.java similarity index 99% rename from src/main/java/build/buf/protovalidate/internal/celext/CustomDeclarations.java rename to src/main/java/build/buf/protovalidate/CustomDeclarations.java index 0ab6a3b2..5c7310fc 100644 --- a/src/main/java/build/buf/protovalidate/internal/celext/CustomDeclarations.java +++ b/src/main/java/build/buf/protovalidate/CustomDeclarations.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; import com.google.api.expr.v1alpha1.Decl; import java.util.ArrayList; diff --git a/src/main/java/build/buf/protovalidate/internal/celext/CustomOverload.java b/src/main/java/build/buf/protovalidate/CustomOverload.java similarity index 99% rename from src/main/java/build/buf/protovalidate/internal/celext/CustomOverload.java rename to src/main/java/build/buf/protovalidate/CustomOverload.java index 34b980c1..f69d59ee 100644 --- a/src/main/java/build/buf/protovalidate/internal/celext/CustomOverload.java +++ b/src/main/java/build/buf/protovalidate/CustomOverload.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; import com.google.common.base.Ascii; import com.google.common.base.Splitter; diff --git a/src/main/java/build/buf/protovalidate/internal/constraints/DescriptorMappings.java b/src/main/java/build/buf/protovalidate/DescriptorMappings.java similarity index 99% rename from src/main/java/build/buf/protovalidate/internal/constraints/DescriptorMappings.java rename to src/main/java/build/buf/protovalidate/DescriptorMappings.java index c444d2ee..d6f33497 100644 --- a/src/main/java/build/buf/protovalidate/internal/constraints/DescriptorMappings.java +++ b/src/main/java/build/buf/protovalidate/DescriptorMappings.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.constraints; +package build.buf.protovalidate; import build.buf.validate.FieldConstraints; import com.google.api.expr.v1alpha1.Type; @@ -27,7 +27,7 @@ /** * DescriptorMappings provides mappings between protocol buffer descriptors and CEL declarations. */ -public final class DescriptorMappings { +final class DescriptorMappings { /** Provides a {@link Descriptor} for {@link FieldConstraints}. */ static final Descriptor FIELD_CONSTRAINTS_DESC = FieldConstraints.getDescriptor(); diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/EmbeddedMessageEvaluator.java b/src/main/java/build/buf/protovalidate/EmbeddedMessageEvaluator.java similarity index 88% rename from src/main/java/build/buf/protovalidate/internal/evaluator/EmbeddedMessageEvaluator.java rename to src/main/java/build/buf/protovalidate/EmbeddedMessageEvaluator.java index 0911ed20..297688e8 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/EmbeddedMessageEvaluator.java +++ b/src/main/java/build/buf/protovalidate/EmbeddedMessageEvaluator.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import java.util.Collections; import java.util.List; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/EnumEvaluator.java b/src/main/java/build/buf/protovalidate/EnumEvaluator.java similarity index 94% rename from src/main/java/build/buf/protovalidate/internal/evaluator/EnumEvaluator.java rename to src/main/java/build/buf/protovalidate/EnumEvaluator.java index 3ab433f4..ec588d82 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/EnumEvaluator.java +++ b/src/main/java/build/buf/protovalidate/EnumEvaluator.java @@ -12,12 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; -import build.buf.protovalidate.ValidationResult; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.EnumRules; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/Evaluator.java b/src/main/java/build/buf/protovalidate/Evaluator.java similarity index 91% rename from src/main/java/build/buf/protovalidate/internal/evaluator/Evaluator.java rename to src/main/java/build/buf/protovalidate/Evaluator.java index 6c1e4802..bb30a83c 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/Evaluator.java +++ b/src/main/java/build/buf/protovalidate/Evaluator.java @@ -12,17 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; import java.util.List; /** * {@link Evaluator} defines a validation evaluator. evaluator implementations may elide type * checking of the passed in value, as the types have been guaranteed during the build phase. */ -public interface Evaluator { +interface Evaluator { /** * Tautology returns true if the evaluator always succeeds. * diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/EvaluatorBuilder.java b/src/main/java/build/buf/protovalidate/EvaluatorBuilder.java similarity index 97% rename from src/main/java/build/buf/protovalidate/internal/evaluator/EvaluatorBuilder.java rename to src/main/java/build/buf/protovalidate/EvaluatorBuilder.java index f421255c..94dc09c3 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/EvaluatorBuilder.java +++ b/src/main/java/build/buf/protovalidate/EvaluatorBuilder.java @@ -12,17 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; -import build.buf.protovalidate.Config; import build.buf.protovalidate.exceptions.CompilationException; -import build.buf.protovalidate.internal.constraints.ConstraintCache; -import build.buf.protovalidate.internal.constraints.DescriptorMappings; -import build.buf.protovalidate.internal.errors.FieldPathUtils; -import build.buf.protovalidate.internal.expression.AstExpression; -import build.buf.protovalidate.internal.expression.CompiledProgram; -import build.buf.protovalidate.internal.expression.Expression; -import build.buf.protovalidate.internal.expression.Variable; import build.buf.validate.Constraint; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; @@ -50,7 +42,7 @@ import org.projectnessie.cel.checker.Decls; /** A build-through cache of message evaluators keyed off the provided descriptor. */ -public class EvaluatorBuilder { +class EvaluatorBuilder { private static final FieldPathElement CEL_FIELD_PATH_ELEMENT = FieldPathUtils.fieldPathElement( FieldConstraints.getDescriptor().findFieldByNumber(FieldConstraints.CEL_FIELD_NUMBER)); diff --git a/src/main/java/build/buf/protovalidate/internal/expression/Expression.java b/src/main/java/build/buf/protovalidate/Expression.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/expression/Expression.java rename to src/main/java/build/buf/protovalidate/Expression.java index e4af662e..9c4c0820 100644 --- a/src/main/java/build/buf/protovalidate/internal/expression/Expression.java +++ b/src/main/java/build/buf/protovalidate/Expression.java @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.expression; +package build.buf.protovalidate; import build.buf.validate.Constraint; import java.util.ArrayList; import java.util.List; /** Expression represents a single CEL expression. */ -public class Expression { +class Expression { /** The id of the constraint. */ public final String id; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/FieldEvaluator.java b/src/main/java/build/buf/protovalidate/FieldEvaluator.java similarity index 95% rename from src/main/java/build/buf/protovalidate/internal/evaluator/FieldEvaluator.java rename to src/main/java/build/buf/protovalidate/FieldEvaluator.java index 07f3d69c..c8069a67 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/FieldEvaluator.java +++ b/src/main/java/build/buf/protovalidate/FieldEvaluator.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import com.google.protobuf.Descriptors.FieldDescriptor; diff --git a/src/main/java/build/buf/protovalidate/internal/errors/FieldPathUtils.java b/src/main/java/build/buf/protovalidate/FieldPathUtils.java similarity index 97% rename from src/main/java/build/buf/protovalidate/internal/errors/FieldPathUtils.java rename to src/main/java/build/buf/protovalidate/FieldPathUtils.java index 4b1103ae..aca207be 100644 --- a/src/main/java/build/buf/protovalidate/internal/errors/FieldPathUtils.java +++ b/src/main/java/build/buf/protovalidate/FieldPathUtils.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.errors; +package build.buf.protovalidate; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; @@ -21,7 +21,7 @@ import javax.annotation.Nullable; /** Utility class for manipulating error paths in violations. */ -public final class FieldPathUtils { +final class FieldPathUtils { private FieldPathUtils() {} /** diff --git a/src/main/java/build/buf/protovalidate/internal/celext/Format.java b/src/main/java/build/buf/protovalidate/Format.java similarity index 99% rename from src/main/java/build/buf/protovalidate/internal/celext/Format.java rename to src/main/java/build/buf/protovalidate/Format.java index 82ea82a0..80faeb0c 100644 --- a/src/main/java/build/buf/protovalidate/internal/celext/Format.java +++ b/src/main/java/build/buf/protovalidate/Format.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; import static java.time.format.DateTimeFormatter.ISO_INSTANT; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/ListEvaluator.java b/src/main/java/build/buf/protovalidate/ListEvaluator.java similarity index 94% rename from src/main/java/build/buf/protovalidate/internal/evaluator/ListEvaluator.java rename to src/main/java/build/buf/protovalidate/ListEvaluator.java index ab240f8e..6b77d229 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/ListEvaluator.java +++ b/src/main/java/build/buf/protovalidate/ListEvaluator.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/MapEvaluator.java b/src/main/java/build/buf/protovalidate/MapEvaluator.java similarity index 97% rename from src/main/java/build/buf/protovalidate/internal/evaluator/MapEvaluator.java rename to src/main/java/build/buf/protovalidate/MapEvaluator.java index 501b316a..1e92accd 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/MapEvaluator.java +++ b/src/main/java/build/buf/protovalidate/MapEvaluator.java @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/MessageEvaluator.java b/src/main/java/build/buf/protovalidate/MessageEvaluator.java similarity index 94% rename from src/main/java/build/buf/protovalidate/internal/evaluator/MessageEvaluator.java rename to src/main/java/build/buf/protovalidate/MessageEvaluator.java index 54a6075f..f5523720 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/MessageEvaluator.java +++ b/src/main/java/build/buf/protovalidate/MessageEvaluator.java @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/MessageValue.java b/src/main/java/build/buf/protovalidate/MessageValue.java similarity index 86% rename from src/main/java/build/buf/protovalidate/internal/evaluator/MessageValue.java rename to src/main/java/build/buf/protovalidate/MessageValue.java index cd3c5bdf..9ec965d7 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/MessageValue.java +++ b/src/main/java/build/buf/protovalidate/MessageValue.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import com.google.protobuf.Descriptors; import com.google.protobuf.Message; @@ -21,11 +21,8 @@ import java.util.Map; import javax.annotation.Nullable; -/** - * The {@link build.buf.protovalidate.internal.evaluator.Value} type that contains a {@link - * com.google.protobuf.Message}. - */ -public final class MessageValue implements Value { +/** The {@link Value} type that contains a {@link com.google.protobuf.Message}. */ +final class MessageValue implements Value { /** Object type since the object type is inferred from the field descriptor. */ private final Object value; diff --git a/src/main/java/build/buf/protovalidate/internal/expression/NowVariable.java b/src/main/java/build/buf/protovalidate/NowVariable.java similarity index 94% rename from src/main/java/build/buf/protovalidate/internal/expression/NowVariable.java rename to src/main/java/build/buf/protovalidate/NowVariable.java index 6fbf4158..ab021979 100644 --- a/src/main/java/build/buf/protovalidate/internal/expression/NowVariable.java +++ b/src/main/java/build/buf/protovalidate/NowVariable.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.expression; +package build.buf.protovalidate; import java.time.Instant; import javax.annotation.Nullable; @@ -24,7 +24,7 @@ * {@link NowVariable} implements {@link Activation}, providing a lazily produced timestamp for * accessing the variable `now` that's constant within an evaluation. */ -public class NowVariable implements Activation { +class NowVariable implements Activation { /** The name of the 'now' variable. */ private static final String NOW_NAME = "now"; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/ObjectValue.java b/src/main/java/build/buf/protovalidate/ObjectValue.java similarity index 84% rename from src/main/java/build/buf/protovalidate/internal/evaluator/ObjectValue.java rename to src/main/java/build/buf/protovalidate/ObjectValue.java index 53dddaf0..1c897220 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/ObjectValue.java +++ b/src/main/java/build/buf/protovalidate/ObjectValue.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Descriptors; @@ -25,11 +25,8 @@ import javax.annotation.Nullable; import org.projectnessie.cel.common.ULong; -/** - * The {@link build.buf.protovalidate.internal.evaluator.Value} type that contains a field - * descriptor and its value. - */ -public final class ObjectValue implements Value { +/** The {@link Value} type that contains a field descriptor and its value. */ +final class ObjectValue implements Value { /** * {@link com.google.protobuf.Descriptors.FieldDescriptor} is the field descriptor for the value. @@ -40,7 +37,7 @@ public final class ObjectValue implements Value { private final Object value; /** - * Constructs a new {@link build.buf.protovalidate.internal.evaluator.ObjectValue}. + * Constructs a new {@link ObjectValue}. * * @param fieldDescriptor The field descriptor for the value. * @param value The value associated with the field descriptor. @@ -90,7 +87,7 @@ public List repeatedValue() { if (fieldDescriptor.isRepeated()) { List list = (List) value; for (Object o : list) { - out.add(new build.buf.protovalidate.internal.evaluator.ObjectValue(fieldDescriptor, o)); + out.add(new ObjectValue(fieldDescriptor, o)); } } return out; @@ -108,12 +105,10 @@ public Map mapValue() { Map out = new HashMap<>(input.size()); for (AbstractMessage entry : input) { Object keyValue = entry.getField(keyDesc); - Value keyJavaValue = - new build.buf.protovalidate.internal.evaluator.ObjectValue(keyDesc, keyValue); + Value keyJavaValue = new ObjectValue(keyDesc, keyValue); Object valValue = entry.getField(valDesc); - Value valJavaValue = - new build.buf.protovalidate.internal.evaluator.ObjectValue(valDesc, valValue); + Value valJavaValue = new ObjectValue(valDesc, valValue); out.put(keyJavaValue, valJavaValue); } diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/OneofEvaluator.java b/src/main/java/build/buf/protovalidate/OneofEvaluator.java similarity index 92% rename from src/main/java/build/buf/protovalidate/internal/evaluator/OneofEvaluator.java rename to src/main/java/build/buf/protovalidate/OneofEvaluator.java index a529d0b1..b2f59f26 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/OneofEvaluator.java +++ b/src/main/java/build/buf/protovalidate/OneofEvaluator.java @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; import build.buf.validate.FieldPathElement; import com.google.protobuf.Descriptors.OneofDescriptor; import com.google.protobuf.Message; @@ -23,7 +22,7 @@ import java.util.List; /** {@link OneofEvaluator} performs validation on a oneof union. */ -public class OneofEvaluator implements Evaluator { +class OneofEvaluator implements Evaluator { /** The {@link OneofDescriptor} targeted by this evaluator. */ private final OneofDescriptor descriptor; diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/UnknownDescriptorEvaluator.java b/src/main/java/build/buf/protovalidate/UnknownDescriptorEvaluator.java similarity index 92% rename from src/main/java/build/buf/protovalidate/internal/evaluator/UnknownDescriptorEvaluator.java rename to src/main/java/build/buf/protovalidate/UnknownDescriptorEvaluator.java index 76552636..380d457d 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/UnknownDescriptorEvaluator.java +++ b/src/main/java/build/buf/protovalidate/UnknownDescriptorEvaluator.java @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; import com.google.protobuf.Descriptors.Descriptor; import java.util.Collections; import java.util.List; diff --git a/src/main/java/build/buf/protovalidate/internal/celext/ValidateLibrary.java b/src/main/java/build/buf/protovalidate/ValidateLibrary.java similarity index 91% rename from src/main/java/build/buf/protovalidate/internal/celext/ValidateLibrary.java rename to src/main/java/build/buf/protovalidate/ValidateLibrary.java index d87da052..f28fe152 100644 --- a/src/main/java/build/buf/protovalidate/internal/celext/ValidateLibrary.java +++ b/src/main/java/build/buf/protovalidate/ValidateLibrary.java @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; -import build.buf.protovalidate.internal.expression.NowVariable; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -27,7 +26,7 @@ * Custom {@link Library} for CEL. Provides all the custom extension function definitions and * overloads. */ -public class ValidateLibrary implements Library { +class ValidateLibrary implements Library { /** Creates a ValidateLibrary with all custom declarations and overloads. */ public ValidateLibrary() {} diff --git a/src/main/java/build/buf/protovalidate/Validator.java b/src/main/java/build/buf/protovalidate/Validator.java index a812649b..cb575f00 100644 --- a/src/main/java/build/buf/protovalidate/Validator.java +++ b/src/main/java/build/buf/protovalidate/Validator.java @@ -15,12 +15,8 @@ package build.buf.protovalidate; import build.buf.protovalidate.exceptions.CompilationException; +import build.buf.protovalidate.exceptions.ExecutionException; import build.buf.protovalidate.exceptions.ValidationException; -import build.buf.protovalidate.internal.celext.ValidateLibrary; -import build.buf.protovalidate.internal.errors.ConstraintViolation; -import build.buf.protovalidate.internal.evaluator.Evaluator; -import build.buf.protovalidate.internal.evaluator.EvaluatorBuilder; -import build.buf.protovalidate.internal.evaluator.MessageValue; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Message; import java.util.ArrayList; @@ -65,7 +61,7 @@ public Validator() { * message is invalid. An exception is thrown if the message cannot be validated because the * evaluation logic for the message cannot be built ({@link CompilationException}), or there is a * type error when attempting to evaluate a CEL expression associated with the message ({@link - * build.buf.protovalidate.exceptions.ExecutionException}). + * ExecutionException}). * * @param msg the {@link Message} to be validated. * @return the {@link ValidationResult} from the evaluation. diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/Value.java b/src/main/java/build/buf/protovalidate/Value.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/evaluator/Value.java rename to src/main/java/build/buf/protovalidate/Value.java index b6a07f3e..5aa920f2 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/Value.java +++ b/src/main/java/build/buf/protovalidate/Value.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import com.google.protobuf.Descriptors; import com.google.protobuf.Message; @@ -24,7 +24,7 @@ * {@link Value} is a wrapper around a protobuf value that provides helper methods for accessing the * value. */ -public interface Value { +interface Value { /** * Get the field descriptor that corresponds to the underlying Value, if it is a message field. * diff --git a/src/main/java/build/buf/protovalidate/internal/evaluator/ValueEvaluator.java b/src/main/java/build/buf/protovalidate/ValueEvaluator.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/evaluator/ValueEvaluator.java rename to src/main/java/build/buf/protovalidate/ValueEvaluator.java index a84359da..ea050b9a 100644 --- a/src/main/java/build/buf/protovalidate/internal/evaluator/ValueEvaluator.java +++ b/src/main/java/build/buf/protovalidate/ValueEvaluator.java @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.evaluator; +package build.buf.protovalidate; import build.buf.protovalidate.exceptions.ExecutionException; -import build.buf.protovalidate.internal.errors.ConstraintViolation; import build.buf.validate.FieldPath; import com.google.protobuf.Descriptors; import java.util.ArrayList; diff --git a/src/main/java/build/buf/protovalidate/internal/expression/Variable.java b/src/main/java/build/buf/protovalidate/Variable.java similarity index 96% rename from src/main/java/build/buf/protovalidate/internal/expression/Variable.java rename to src/main/java/build/buf/protovalidate/Variable.java index b0aaebfd..e026ef6e 100644 --- a/src/main/java/build/buf/protovalidate/internal/expression/Variable.java +++ b/src/main/java/build/buf/protovalidate/Variable.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.expression; +package build.buf.protovalidate; import javax.annotation.Nullable; import org.projectnessie.cel.interpreter.Activation; @@ -22,7 +22,7 @@ * {@link Variable} implements {@link org.projectnessie.cel.interpreter.Activation}, providing a * lightweight named variable to cel.Program executions. */ -public class Variable implements Activation { +class Variable implements Activation { /** The {@value} variable in CEL. */ public static final String THIS_NAME = "this"; diff --git a/src/test/java/build/buf/protovalidate/internal/celext/CustomOverloadTest.java b/src/test/java/build/buf/protovalidate/CustomOverloadTest.java similarity index 99% rename from src/test/java/build/buf/protovalidate/internal/celext/CustomOverloadTest.java rename to src/test/java/build/buf/protovalidate/CustomOverloadTest.java index 73eb9344..24deb7ec 100644 --- a/src/test/java/build/buf/protovalidate/internal/celext/CustomOverloadTest.java +++ b/src/test/java/build/buf/protovalidate/CustomOverloadTest.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/src/test/java/build/buf/protovalidate/internal/celext/FormatTest.java b/src/test/java/build/buf/protovalidate/FormatTest.java similarity index 92% rename from src/test/java/build/buf/protovalidate/internal/celext/FormatTest.java rename to src/test/java/build/buf/protovalidate/FormatTest.java index 4c963e1e..a5656505 100644 --- a/src/test/java/build/buf/protovalidate/internal/celext/FormatTest.java +++ b/src/test/java/build/buf/protovalidate/FormatTest.java @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package build.buf.protovalidate.internal.celext; +package build.buf.protovalidate; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.projectnessie.cel.common.types.ListT; diff --git a/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java b/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java index 6623f177..e8f05110 100644 --- a/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java +++ b/src/test/java/build/buf/protovalidate/ValidatorDifferentJavaPackagesTest.java @@ -17,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; import build.buf.protovalidate.exceptions.ValidationException; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement; diff --git a/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java b/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java index 9cd6d8a1..a358b6d6 100644 --- a/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java +++ b/src/test/java/build/buf/protovalidate/ValidatorDynamicMessageTest.java @@ -17,7 +17,6 @@ import static com.example.imports.validationtest.PredefinedProto.isIdent; import static org.assertj.core.api.Assertions.assertThat; -import build.buf.protovalidate.internal.errors.FieldPathUtils; import build.buf.validate.FieldConstraints; import build.buf.validate.FieldPath; import build.buf.validate.FieldPathElement;