diff options
author | Jim Hahn <jrh3@att.com> | 2021-04-26 17:41:25 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-04-29 11:30:24 -0400 |
commit | 3b00f1c32b89282dcbb74d3d3645e263f005319e (patch) | |
tree | a760975aaf1975905db7069d6d733e7e77b0f797 /common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java | |
parent | 322b149685bb2f9405999f5a299130694d1b8fe3 (diff) |
Remove GroupValidationResult
Removed GroupValidationResult, replacing it with BeanValidationResult.
Modified the ParameterGroup subclasses to use BeanValidator, adding
annotations where needed to trigger the validations that had been
automatically performed by GroupValidationResult.
Added Size annotation, used to verify minimum lengths of maps and
collections.
Added ClassName annotation, used to verify that a property contains the
name of a class that is actually in the classpath.
Added another addResult() method to make it easier when replacing calls
to GroupValidationResult setResult() method with BeanValidationResult.
Issue-ID: POLICY-2059
Change-Id: Id4da24886908723006624c5d53edeb034102299d
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java')
-rw-r--r-- | common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java index f0f34ac1..8a987bdd 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterGroupImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,9 @@ package org.onap.policy.common.parameters; +import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; @@ -32,30 +34,16 @@ import org.onap.policy.common.parameters.annotations.NotNull; @NotBlank @Getter @Setter +@NoArgsConstructor +@AllArgsConstructor public class ParameterGroupImpl implements ParameterGroup { /** - * Group name. Note: this MUST not be "private" or it will not be validated. + * Group name. */ - protected String name; - - /** - * Constructs the object, with a {@code null} name. - */ - public ParameterGroupImpl() { - this.name = null; - } - - /** - * Constructs the object. - * - * @param name the group's name - */ - public ParameterGroupImpl(String name) { - this.name = name; - } + private String name; @Override - public GroupValidationResult validate() { - return new GroupValidationResult(this); + public BeanValidationResult validate() { + return new BeanValidator().validateTop(getClass().getSimpleName(), this); } } |