Home > Back-end >  Who knows what role the annotation? @ CustomAttributesAnnotation
Who knows what role the annotation? @ CustomAttributesAnnotation

Time:09-20

Look at the others code, Java entity class to turn XML, a field with the custom annotation @ CustomAttributesAnnotation
And the key parameters="class", value="https://bbs.csdn.net/topics/sql-date" what is action? What is this principle? Don't have custom annotations online to find a lot of talking about this kind of

@ CustomAttributesAnnotation (key="class", value="https://bbs.csdn.net/topics/sql-date")
@ XStreamAlias (" endDate ")
Private String endDate;

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

@ Target (ElementType FIELD)
@ Retention (RetentionPolicy RUNTIME)
Public @ interface CustomAttributesAnnotation {
Public String value (the default) "";
Public String key (default) "";
}



CodePudding user response:

You may see the conversion process will understand what is the meaning of this

CodePudding user response:

refer to the original poster qq_33377408 response:
watch others code, Java entity class to turn XML, a field with the custom annotation @ CustomAttributesAnnotation
And the key parameters="class", value="https://bbs.csdn.net/topics/sql-date" what is action? What is this principle? Don't have custom annotations online to find a lot of talking about this kind of

@ CustomAttributesAnnotation (key="class", value="https://bbs.csdn.net/topics/sql-date")
@ XStreamAlias (" endDate ")
Private String endDate;

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

@ Target (ElementType FIELD)
@ Retention (RetentionPolicy RUNTIME)
Public @ interface CustomAttributesAnnotation {
Public String value (the default) "";
Public String key (default) "";
}

Regardless of what it is for, Java entity class turn XML is one line of code, don't need so complicated;
Object, the Map, List, json string can turn XML
  • Related