View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.xml.config;
8   
9   import org.mule.config.i18n.CoreMessages;
10  
11  import javax.xml.bind.JAXBContext;
12  
13  import org.springframework.beans.factory.config.AbstractFactoryBean;
14  
15  /**
16   * TODO
17   */
18  public class JaxbContextFactoryBean extends AbstractFactoryBean
19  {
20      private String packageNames;
21      private String name;
22  
23      @Override
24      public Class getObjectType()
25      {
26          return JAXBContext.class;
27      }
28  
29      @Override
30      protected Object createInstance() throws Exception
31      {
32          if(packageNames==null)
33          {
34              throw new IllegalArgumentException(CoreMessages.objectIsNull("packageNames").getMessage());
35          }
36          return JAXBContext.newInstance(packageNames);
37      }
38  
39      public String getPackageNames()
40      {
41          return packageNames;
42      }
43  
44      public void setPackageNames(String packageNames)
45      {
46          this.packageNames = packageNames;
47      }
48  
49      public String getName()
50      {
51          return name;
52      }
53  
54      public void setName(String name)
55      {
56          this.name = name;
57      }
58  }