| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <!DOCTYPE codetemplates PUBLIC "-//NetBeans//DTD Editor Code Templates settings 1.0//EN" "http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd"> |
| <codetemplates> |
| <codetemplate abbreviation="jaxbm" xml:space="preserve"> |
| <code>try { |
| javax.xml.bind.JAXBContext jaxbCtx= javax.xml.bind.JAXBContext.newInstance( ${OBJ2M instanceof="java.lang.Object" default="obj2BMarshalled"}.getClass().getPackage().getName()); |
| javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller(); |
| marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N |
| marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); |
| marshaller.marshal(${OBJ2M} , System.out); |
| } catch (javax.xml.bind.JAXBException ex) { |
| // XXXTODO Handle exception |
| java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N |
| }</code> |
| <description>Sample template to marshal JAXB objects.</description> |
| </codetemplate> |
| <codetemplate abbreviation="jaxbu" xml:space="preserve"> |
| <code> |
| try { |
| javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(${UM_OBJ instanceof="java.lang.Object" default="umObj"}.getClass().getPackage().getName()); |
| javax.xml.bind.Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller(); |
| ${UM_OBJ} = ${TYPE_CAST cast default=""} unmarshaller.unmarshal(new java.io.File("File path")); //NOI18N |
| } catch (javax.xml.bind.JAXBException ex) { |
| // XXXTODO Handle exception |
| java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N |
| } |
| </code> |
| <description>Sample template to unmarshal JAXB objects.</description> |
| </codetemplate> |
| </codetemplates> |