Class PackageSetBuilder


  • public class PackageSetBuilder
    extends Object
    In order to marshal or unmarshal the user data, we need to know the set of packages involved. The set of packages is used to construct an appropriate JAXBContext object during the marshalling/unmarshalling.

    There are two ways to get this data.

    Schema Walk (preferred): Get the list of packages by walking the schemas that are referenced by the wsdl (or generated wsdl). Each schema represents a different package. The package is obtained using the jaxb customization or JAXB default ns<->package rule.

    Annotation Walk(secondary) : Walk the list of Endpoints, Operations, Parameters, etc. and build a list of packages by looking at the classes involved.

    The Schema Walk is faster and more complete, but relies on the presence of the schema or wsdl.

    The Annotation Walk is slower and is not complete. For example, the annotation walk may not discover the packages for derived types that are defined in a different schema than the formal parameter types.

    • Method Detail

      • getPackagesFromSchema

        public static TreeSet<String> getPackagesFromSchema​(ServiceDescription serviceDesc)
        Walks the schemas of the serviceDesc's wsdl (or generated wsdl) to determine the list of packages. This is the preferred algorithm for discovering the package set.
        Parameters:
        serviceDesc - ServiceDescription
        Returns:
        Set of Packages
      • getPackageFromClassName

        public static String getPackageFromClassName​(String className)
        Return the package associated with the class name. The className may not be specified (in which case a null Package is returned). If class has anunnamed package return ""
        Parameters:
        className - String (may be null or empty)
        Returns:
        String or null if problems occur
      • getPackageFromClass

        public static String getPackageFromClass​(Class cls)
        Return the package associated with the class name. The className may not be specified (in which case a null Package is returned). if class has unnamed package return ""
        Parameters:
        cls - Class
        Returns:
        String or null