Class GlobalCustom


  • public class GlobalCustom
    extends NestingBase
    Global customization information. This includes some options specific to the <binding> element of the definition, as well as controls for structuring of the generated binding(s). It handles the binding customization child elements directly, by invoking the abstract unmarshallers for the child elements to process the content. It also allows for extension elements which are not part of the binding customization structure, as long as the binding in use defines the unmarshalling for these elements.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • s_allowedAttributes

        public static final StringArray s_allowedAttributes
        Enumeration of allowed attribute names
      • ELEMENT_NAME

        public static final java.lang.String ELEMENT_NAME
        Element name in XML customization file.
        See Also:
        Constant Field Values
      • s_directionEnum

        static final EnumSet s_directionEnum
      • m_packageMap

        private java.util.Map m_packageMap
      • m_extensionChildren

        private java.util.List m_extensionChildren
      • m_addConstructors

        private boolean m_addConstructors
      • m_forceClasses

        private boolean m_forceClasses
      • m_trackSource

        private boolean m_trackSource
      • m_namespaceModular

        private boolean m_namespaceModular
      • m_isInput

        private boolean m_isInput
      • m_isOutput

        private boolean m_isOutput
      • m_unmarshalledClasses

        private java.util.ArrayList m_unmarshalledClasses
    • Constructor Detail

      • GlobalCustom

        public GlobalCustom​(IClassLocator loc)
        Constructor with class locator supplied.
        Parameters:
        loc -
      • GlobalCustom

        public GlobalCustom()
        Constructor. This always creates the default package as the only direct child, since other packages will be treated as children of the default package.
    • Method Detail

      • preSet

        private void preSet​(IUnmarshallingContext uctx)
        Make sure all attributes are defined.
        Parameters:
        uctx - unmarshalling context
      • getUnmarshalledClasses

        public java.util.ArrayList getUnmarshalledClasses()
        Get list of unmarshalled classes. This list is populated by the custom unmarshalling code as the customizations document is unmarshalled.
        Returns:
        list
      • isAddConstructors

        public boolean isAddConstructors()
        Get 'add-constructors' setting.
        Returns:
        'add-constructors' value
      • setAddConstructors

        public void setAddConstructors​(boolean add)
        Set 'add-constructors' value.
        Parameters:
        add - 'add-constructors' value
      • isForceClasses

        public boolean isForceClasses()
        Get 'force-classes' setting.
        Returns:
        'force-classes' value
      • setForceClasses

        public void setForceClasses​(boolean force)
        Set 'force-classes' value.
        Parameters:
        force - 'force-classes' value
      • isTrackSource

        public boolean isTrackSource()
        Get 'track-source' attribute value.
        Returns:
        'track-source' value
      • setTrackSource

        public void setTrackSource​(boolean track)
        Set 'track-source' value.
        Parameters:
        track - 'track-source' value
      • isInput

        public boolean isInput()
        Check for an input binding.
        Returns:
        input flag
      • setInput

        public void setInput​(boolean input)
        Set input binding flag.
        Parameters:
        input -
      • isOutput

        public boolean isOutput()
        Check for an output binding.
        Returns:
        output flag
      • setOutput

        public void setOutput​(boolean output)
        Set output binding falg.
        Parameters:
        output -
      • getClassLocator

        protected IClassLocator getClassLocator()
        Get class locator.
        Returns:
        locator
      • getClassInfo

        public IClass getClassInfo​(java.lang.String type)
        Get class information.
        Parameters:
        type - fully-qualified class name
        Returns:
        information, or null if unable to load
      • getExtensionChildren

        public java.util.List getExtensionChildren()
        Get the extension elements used in this customization. This does not include the <package> or <class> child elements, which are added directly to the customization structures.
        Returns:
        child list
      • internalAddExtensionChild

        protected void internalAddExtensionChild​(java.lang.Object child)
        Internal method used during unmarshalling to add a child extension element.
        Parameters:
        child -
      • addExtensionChild

        public void addExtensionChild​(java.lang.Object child)
        Add a child extension element. This both adds the child to the list and invokes the extension element's IApply.apply(IClassLocator) method, if present.
        Parameters:
        child -
      • isClassUsed

        public boolean isClassUsed​(java.lang.String type)
        Check if a class is included in the customization information. This method does not alter the structures in any way, it only checks if the class customization information is part of the existing structure.
        Parameters:
        type - fully qualified class name
        Returns:
        true if class includes, false if not
      • getClassCustomization

        public ClassCustom getClassCustomization​(java.lang.String type)
        Get class customization information.
        Parameters:
        type - fully qualified class name
        Returns:
        class information (null if not defined)
      • buildClassCustomization

        private ClassCustom buildClassCustomization​(java.lang.String type)
        Build new class customization information. This creates the customization information and adds it to the internal structures, initializing all values based on the settings inherited from <package> and <global> elements of the structure. This method should only be used after first calling getClassCustomization(String) and obtaining a null result.
        Parameters:
        type - fully qualified class name
        Returns:
        class information
      • forceClassCustomization

        private ClassCustom forceClassCustomization​(java.lang.String type)
        Get class customization information, creating it if it doesn't already exist. This internal method supplies the class information in uninitialized form, so that data can be unmarshalled before initialization.
        Parameters:
        type - fully qualified class name
        Returns:
        class information
      • addClassCustomization

        public ClassCustom addClassCustomization​(java.lang.String type)
        Get initialized class customization information, creating it if it doesn't already exist.
        Parameters:
        type - fully qualified class name
        Returns:
        class information
      • isKnownMapping

        public boolean isKnownMapping​(java.lang.String type)
        Check if type represents a known mapping.
        Parameters:
        type - fully qualified class name
        Returns:
        known mapping flag
      • setDirectionText

        private void setDirectionText​(java.lang.String text,
                                      IUnmarshallingContext ictx)
        Direction set text method. This is intended for use during unmarshalling. TODO: add validation
        Parameters:
        text -
        ictx -
      • getDirectionText

        private java.lang.String getDirectionText()
        Direction get text method. This is intended for use during marshalling.
        Returns:
        text
      • initClasses

        public void initClasses()
        Initialize the global default namespace, along with special classes with built-in defaults. This needs to be done as a separate step before unmarshalling, so that the special classes are available for use.
      • fillClasses

        public void fillClasses()
        Fills in class information based on inspection of the actual class data. This needs to be done as a separate step following unmarshalling, so that the full details of the unmarshalled customizations are available.
      • getPackage

        public PackageCustom getPackage​(java.lang.String name)
        Get package customizations. If the requested package is already defined the existing instance will be returned, otherwise a new instance will be created (along with any ancestor packages) and added to the structure.
        Parameters:
        name -
        Returns:
        package