mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-30 22:25:37 +00:00
ref[protocol]: modify compatible annotation
This commit is contained in:
@@ -19,7 +19,7 @@ import java.lang.annotation.*;
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface Note {
|
||||
|
||||
String value() default "";
|
||||
|
||||
@@ -26,6 +26,5 @@ public @interface Protocol {
|
||||
|
||||
boolean enhance() default true;
|
||||
|
||||
String note() default "";
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,9 @@ public abstract class GenerateProtocolNote {
|
||||
for (var protocolRegistration : protocolRegistrations) {
|
||||
var protocolClazz = protocolRegistration.protocolConstructor().getDeclaringClass();
|
||||
var classNote = StringUtils.EMPTY;
|
||||
var protocolClass = protocolClazz.getDeclaredAnnotation(Protocol.class);
|
||||
if (protocolClass != null && StringUtils.isNotEmpty(protocolClass.note())) {
|
||||
classNote = StringUtils.trim(protocolClass.note());
|
||||
var protocolClass = protocolClazz.getDeclaredAnnotation(Note.class);
|
||||
if (protocolClass != null && StringUtils.isNotEmpty(protocolClass.value())) {
|
||||
classNote = StringUtils.trim(protocolClass.value());
|
||||
}
|
||||
|
||||
var fieldNoteMap = new HashMap<String, String>();
|
||||
|
||||
@@ -20,7 +20,8 @@ import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Protocol(id = 100, note = "复杂的对象,包括了各种复杂的结构,数组,List,Set,Map")
|
||||
@Protocol(id = 100)
|
||||
@Note("复杂的对象,包括了各种复杂的结构,数组,List,Set,Map")
|
||||
public class ComplexObject {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user