refactor: align Glow transaction field metadata
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 2m20s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 2m20s
This commit is contained in:
@@ -17,6 +17,7 @@ package io.shinhanlife.glow;
|
||||
*/
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Deprecated(forRemoval = false)
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.shinhanlife.glow;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.shinhanlife.glow.communication.annotation.GlowTrgmField;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.shinhanlife.glow.communication.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/** Declares fixed-width Glow transaction-message metadata for a DTO field. */
|
||||
@Target({ElementType.LOCAL_VARIABLE, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface GlowTrgmField {
|
||||
|
||||
int order();
|
||||
|
||||
int length() default 0;
|
||||
|
||||
int decimal() default 0;
|
||||
|
||||
String description() default "";
|
||||
|
||||
String target() default "";
|
||||
|
||||
String type() default "";
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.shinhanlife.glow.util;
|
||||
|
||||
import io.shinhanlife.glow.GlowTrgmField;
|
||||
import io.shinhanlife.glow.communication.annotation.GlowTrgmField;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.shinhanlife.glow.communication.annotation;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class GlowTrgmFieldContractTest {
|
||||
|
||||
private static class StandardTrgmDto {
|
||||
@GlowTrgmField(order = 1, length = 8, decimal = 2, description = "금액", target = "body", type = "gs")
|
||||
private String amount;
|
||||
}
|
||||
|
||||
@Test
|
||||
void exposesTheStandardGlowTrgmFieldMetadata() throws Exception {
|
||||
Field field = StandardTrgmDto.class.getDeclaredField("amount");
|
||||
GlowTrgmField metadata = field.getAnnotation(GlowTrgmField.class);
|
||||
|
||||
assertEquals(1, metadata.order());
|
||||
assertEquals(8, metadata.length());
|
||||
assertEquals(2, metadata.decimal());
|
||||
assertEquals("금액", metadata.description());
|
||||
assertEquals("body", metadata.target());
|
||||
assertEquals("gs", metadata.type());
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.shinhanlife.glow.GlowTrgmField;
|
||||
import io.shinhanlife.glow.communication.annotation.GlowTrgmField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user