File tree Expand file tree Collapse file tree
src/main/java/com/github/simplemocks/error_service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ dependencies {
2929
3030 implementation(" jakarta.annotation:jakarta.annotation-api:${project.property(" lib_annotation_api_version" )} " )
3131
32+ implementation(" com.github.simple-mocks:api-common:${project.property(" lib_api_common_version" )} " )
33+
3234}
3335
3436tasks.withType<JavaCompile >().configureEach {
Original file line number Diff line number Diff line change @@ -7,8 +7,11 @@ jdk_version=21
77author =Simple Mocks
88project_name =api-error
99group =com.github.simple-mocks
10- version =0.0.12
10+ version =0.0.13
1111
1212# 3rd party libraries
1313lib_lombok_version =1.18.32
14- lib_annotation_api_version =3.0.0
14+ lib_annotation_api_version =3.0.0
15+
16+ # service APIs deps
17+ lib_api_common_version =0.0.1
Original file line number Diff line number Diff line change 55import lombok .NoArgsConstructor ;
66import lombok .Setter ;
77
8+ import java .io .Serializable ;
9+
810/**
911 * Localized error dto
1012 *
1517@ Setter
1618@ NoArgsConstructor
1719@ AllArgsConstructor
18- public class LocalizedError {
20+ public class LocalizedError implements Serializable {
1921 /**
2022 * Human-readable title
2123 */
Original file line number Diff line number Diff line change 1+ package com .github .simplemocks .error_service .api .rs ;
2+
3+ import com .github .simplemocks .common .api .rs .StandardBodyRs ;
4+ import com .github .simplemocks .error_service .api .dto .LocalizedError ;
5+ import jakarta .annotation .Nullable ;
6+ import lombok .Builder ;
7+
8+ /**
9+ * Localize error response dto
10+ *
11+ * @author sibmaks
12+ * @since 0.0.1
13+ */
14+ @ Builder
15+ public class LocalizeErrorRs extends StandardBodyRs <LocalizedError > {
16+
17+ /**
18+ * Construct localize error response
19+ *
20+ * @param localizedError localized error
21+ */
22+ public LocalizeErrorRs (@ Nullable LocalizedError localizedError ) {
23+ super (localizedError );
24+ }
25+
26+ }
Original file line number Diff line number Diff line change 11package com .github .simplemocks .error_service .api .service ;
22
33
4- import com .github .simplemocks .error_service .api .dto .LocalizedError ;
54import com .github .simplemocks .error_service .api .rq .LocalizeErrorRq ;
5+ import com .github .simplemocks .error_service .api .rs .LocalizeErrorRs ;
66import jakarta .annotation .Nonnull ;
77
88/**
@@ -20,6 +20,6 @@ public interface ErrorService {
2020 * @return description of error or null
2121 */
2222 @ Nonnull
23- LocalizedError localize (@ Nonnull LocalizeErrorRq rq );
23+ LocalizeErrorRs localize (@ Nonnull LocalizeErrorRq rq );
2424
2525}
Original file line number Diff line number Diff line change 1+ package com .github .simplemocks .error_service .mutable .api .source ;
2+
3+ import com .github .simplemocks .error_service .api .dto .ErrorSourceId ;
4+
5+ import java .lang .annotation .*;
6+
7+ /**
8+ * Error localizations source annotation
9+ *
10+ * @author sibmaks
11+ * @since 0.0.13
12+ */
13+ @ Retention (RetentionPolicy .RUNTIME )
14+ @ Target (ElementType .TYPE )
15+ @ Documented
16+ @ Repeatable (ErrorLocalizationsJsonSources .class )
17+ public @interface ErrorLocalizationsJsonSource {
18+
19+ /**
20+ * Error source system code
21+ *
22+ * @return system code
23+ */
24+ String systemCode ();
25+
26+ /**
27+ * Error kind code
28+ *
29+ * @return kind code
30+ */
31+ String kindCode () default ErrorSourceId .DEFAULT_KIND_CODE ;
32+
33+ /**
34+ * Locale iso3 code
35+ *
36+ * @return iso3 language code
37+ */
38+ String iso3Code ();
39+
40+ /**
41+ * Path to json file
42+ *
43+ * @return path to file
44+ */
45+ String path ();
46+ }
Original file line number Diff line number Diff line change 1+ package com .github .simplemocks .error_service .mutable .api .source ;
2+
3+ import java .lang .annotation .*;
4+
5+ /**
6+ * Localization source annotation
7+ *
8+ * @author sibmaks
9+ * @since 0.0.3
10+ */
11+ @ Retention (RetentionPolicy .RUNTIME )
12+ @ Target (ElementType .TYPE )
13+ @ Documented
14+ public @interface ErrorLocalizationsJsonSources {
15+
16+ /**
17+ * All localization JSON sources
18+ *
19+ * @return localization sources
20+ */
21+ ErrorLocalizationsJsonSource [] value ();
22+
23+ }
You can’t perform that action at this time.
0 commit comments