diff options
Diffstat (limited to 'common-parameters/src/main/java/org/onap/policy/common/parameters/annotations')
8 files changed, 165 insertions, 8 deletions
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/ClassName.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/ClassName.java new file mode 100644 index 00000000..14d76fd7 --- /dev/null +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/ClassName.java @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.common.parameters.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicates that a field (i.e., String) identifies the name of a class in the classpath. + */ +@Retention(RUNTIME) +@Target({FIELD, TYPE_USE}) +public @interface ClassName { + +} diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Max.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Max.java index 1d8fd90f..f28fd2cf 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Max.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Max.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. @@ -21,13 +21,14 @@ package org.onap.policy.common.parameters.annotations; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; @Retention(RUNTIME) -@Target(FIELD) +@Target({FIELD, TYPE_USE}) public @interface Max { /** diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Min.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Min.java index 9ad6d7e0..305d9810 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Min.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Min.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. @@ -21,13 +21,14 @@ package org.onap.policy.common.parameters.annotations; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; @Retention(RUNTIME) -@Target(FIELD) +@Target({FIELD, TYPE_USE}) public @interface Min { /** diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotBlank.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotBlank.java index 169fa593..0744beb5 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotBlank.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotBlank.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. @@ -22,6 +22,7 @@ package org.onap.policy.common.parameters.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; @@ -31,7 +32,7 @@ import java.lang.annotation.Target; * Indicates that a field (i.e., String) may not be empty. */ @Retention(RUNTIME) -@Target({TYPE, FIELD}) +@Target({TYPE, FIELD, TYPE_USE}) public @interface NotBlank { } diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotNull.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotNull.java index 3c7bc8b7..81356005 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotNull.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/NotNull.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. @@ -22,6 +22,7 @@ package org.onap.policy.common.parameters.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; @@ -31,7 +32,7 @@ import java.lang.annotation.Target; * Indicates that a field may not be null. */ @Retention(RUNTIME) -@Target({TYPE, FIELD}) +@Target({TYPE, FIELD, TYPE_USE}) public @interface NotNull { } diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Pattern.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Pattern.java new file mode 100644 index 00000000..91a74d70 --- /dev/null +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Pattern.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020-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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.common.parameters.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target({FIELD, TYPE_USE}) +public @interface Pattern { + + /** + * Regular expression to be matched. + */ + String regexp(); +} diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Size.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Size.java new file mode 100644 index 00000000..160e0124 --- /dev/null +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Size.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.common.parameters.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicates the size of a Map or Collection. + */ +@Retention(RUNTIME) +@Target({FIELD, TYPE_USE}) +public @interface Size { + + /** + * The minimum size allowed. + * + * @return the minimum size allowed + */ + int min(); +} diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Valid.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Valid.java new file mode 100644 index 00000000..227a726f --- /dev/null +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/annotations/Valid.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020-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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.common.parameters.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target({TYPE, FIELD, TYPE_USE}) +public @interface Valid { + +} |