Skip to content

Commit

Permalink
ref[protocol]: modify compatible annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Sep 26, 2023
1 parent b2144eb commit ec9ade6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion protocol/src/main/java/com/zfoo/protocol/anno/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Note {

String value() default "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@

boolean enhance() default true;

String note() default "";
}

Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public static void initProtocolNote(List<IProtocolRegistration> protocolRegistra
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>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import java.util.*;

@Protocol(id = 100, note = "复杂的对象,包括了各种复杂的结构,数组,List,Set,Map")
@Protocol(id = 100)
@Note("复杂的对象,包括了各种复杂的结构,数组,List,Set,Map")
public class ComplexObject {


Expand Down

0 comments on commit ec9ade6

Please sign in to comment.