Highlight
Tips
Highlighting fields can be achieved by custom annotation @HighLight, which can be added to the fields that need to be highlighted
# Annotation usage example
public class Document{
/**
* Fields that need to be highlighted
*/
@HighLight
private String content;
// Omit other extraneous fields...
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Tips
If you do not want the original field value to be overwritten by the highlighted field, then you need to specify the mappingField in the @HighLight annotation and add the field to the corresponding entity class. After this configuration, the highlighted content is returned in the highlightContent field, and the original content The value of the field still returns its own value.
E.g:
public class Document{
/**
* Fields that need to be highlighted
*/
@HighLight(mappingField = "highlightContent")
private String content;
/**
* Highlight the field whose return value is mapped
*/
private String highlightContent;
// Omit other extraneous fields...
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Others
- The highlight annotation supports setting the length fragmentSize of the content intercepted by the highlight return, the default value is 100
- Highlight annotation supports setting the label of highlighted content, the default is em
Help us improve this document (opens new window)
Last update: 2024/03/29