Video: Kev siv @XmlRootElement annotation yog dab tsi?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
@ XmlRootElement yog ib lus piav qhia uas neeg yog siv siv nrog JAXB (JSR-222). Nws yog lub hom phiaj yog kom tsis txhob koom nrog lub hauv paus ntsiab lus nrog ib chav kawm. Txij li cov chav kawm JAXB daim ntawv qhia rau cov hom nyuaj, nws muaj peev xwm ua tau rau ib chav kawm kom sib haum rau ntau lub hauv paus ntsiab lus.
Tib neeg kuj nug, JAXB siv dab tsi?
JAXB sawv rau Java Architecture rau XML Binding. Nws muab mechanism rau marshal (sau) java ua cov khoom rau hauv XML thiab unmarshal (nyeem) XML rau hauv cov khoom. Yooj yim, koj tuaj yeem hais tias nws yog siv los hloov pauv java ua object rau hauv xml thiab vice-versa.
@XmlType yog dab tsi? Cov @ XmlType annotation tuaj yeem txhais tau rau hauv chav kawm. Cov ntsiab lus annotation propOrder() hauv @ XmlType annotation tso cai rau koj los qhia meej cov ntsiab lus txiav txim hauv hom schema generated. Hauv cov xwm txheej zoo li no, cov lus piav qhia @XmlAccessorOrder ua haujlwm ua ntej. Thaum cov ntsiab lus hauv chav kawm tau teev tseg los ntawm @ XmlType.
Tsis tas li ntawd, @XmlElement yog dab tsi hauv Java?
Maps cov cuab yeej JavaBean rau XML cov khoom tau muab los ntawm lub npe khoom. Kev siv. @ XmlElement annotation tuaj yeem siv nrog cov kev pabcuam hauv qab no: JavaBean cov cuab yeej. tsis zoo li qub, tsis hloov chaw.
XmlTransient yog dab tsi?
Cov @ XmlTransient annotation yog qhov muaj txiaj ntsig zoo rau kev daws cov npe sib tsoo ntawm JavaBean lub npe khoom thiab lub npe teb lossis tiv thaiv daim duab qhia chaw ntawm thaj chaw / khoom. Cov khoom ntawm cov chav kawm zoo li no yuav raug mapped rau XML nrog rau nws cov chav kawm muab los, zoo li cov chav kawm yog inlined.