/* Ċ Ġ* ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . Ġand Ġother Ġcontributors . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ Ġ*/ Ċ Ċ package Ġcom . jetbrains . plugin . structure . team city . beans Ċ Ċ import Ġjava . io . InputStream Ċ import Ġjavax . xml . bind . JAXB Context Ċ import Ġjavax . xml . bind . Unmarshal Exception Ċ import Ġjavax . xml . parsers . Document BuilderFactory Ċ Ċ object ĠTeam city Plugin Bean Extractor Ġ{ ĊĠ Ġprivate Ġval Ġjax b Context Ġ= ĠJAXB Context . newInstance ( Team city Plugin Bean :: class . java ) ĊĠ Ġprivate Ġval Ġdocument Builder Ġ= ĠDocument BuilderFactory . newInstance (). new Document Builder () ĊĊĠ Ġ@ Throws ( Unmarshal Exception :: class ) ĊĠ Ġfun Ġextract Plugin Bean ( inputStream : ĠInputStream ): ĠTeam city Plugin Bean Ġ{ ĊĠĠĠ Ġval Ġdocument Ġ= Ġdocument Builder . parse ( inputStream ) ĊĠĠĠ Ġval Ġun marshaller Ġ= Ġjax b Context . create Unmarshaller () ĊĠĠĠ Ġreturn Ġun marshaller . un marshal ( document , ĠTeam city Plugin Bean :: class . java ). value ĊĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠUnmarshal Exception (" Metadata Ġelement Ġnot Ġfound ") ĊĠ Ġ} Ċ }