Class CustomBase

java.lang.Object
org.jibx.custom.classes.CustomBase
Direct Known Subclasses:
FaultCustom, SharedNestingBase, SharedValueBase, ThrowsCustom

public class CustomBase extends Object
Base class for all customizations. This defines a way to navigate up the tree of nested components without making assumptions about the specific type of the containing components. This allows for other types of customizations, beyond the binding customizations included directly in this package. This also includes enumeration definitions which are used with both base and extension customizations.
Author:
Dennis M. Sosnoski
  • Field Details

  • Constructor Details

    • CustomBase

      public CustomBase(SharedNestingBase parent)
      Constructor.
      Parameters:
      parent -
  • Method Details

    • getParent

      public SharedNestingBase getParent()
      Get container.
      Returns:
      container
    • getGlobal

      public GlobalCustom getGlobal()
      Get global customizations root.
      Returns:
      global customization
    • convertName

      public static String convertName(String base, int code)
      Convert class, method, or parameter name to XML name.
      Parameters:
      base - class or simple field name to be converted
      code - conversion format style code
      Returns:
      XML name
    • deriveItemName

      public static String deriveItemName(String cname, String type, int code)
      Derive name for item in a collection. If the supplied collection name ends in a recognized plural form the derived item name is the singular version of the collection name. Otherwise, it is the converted name of the collection item class, or just "item" if the class is unknown. TODO: internationalization?
      Parameters:
      cname - collection name (null if none)
      type - item type (null if unknown)
      code - conversion format style code
      Returns:
      item name
    • packageOfType

      public static String packageOfType(String type)
      Get the package from a fully-qualified type name.
      Parameters:
      type - fully-qualified type name
      Returns:
      package of the type (empty string if in default package)
    • packageToNamespace

      public static String packageToNamespace(String pkgpth)
      Create a namespace URL from a package path.
      Parameters:
      pkgpth - fully-qualified package name
      Returns:
      namespace based on package (null if none)
    • deriveNamespace

      public static String deriveNamespace(String uri, String pkgpth, int style)
      Derive namespace using specified technique.
      Parameters:
      uri - base namespace URI (null if none)
      pkgpth - fully qualified package name
      style - namespace style code
      Returns:
      derived namespace
    • validateAttributes

      protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs)
      Validate attributes of element. This is designed to be called during unmarshalling as part of the pre-set method processing when a subclass instance is being created.
      Parameters:
      ictx - unmarshalling context
      attrs - attributes array
    • getContainingObject

      protected static Object getContainingObject(IUnmarshallingContext ictx)
      Gets the parent element link from the unmarshalling stack. This method is for use by factories during unmarshalling.
      Parameters:
      ictx - unmarshalling context
      Returns:
      containing class