Class PropertyUtil

java.lang.Object
com.pnfsoftware.jeb.core.properties.impl.PropertyUtil

public class PropertyUtil extends Object
Utility routines for properties, property managers, and property definition managers.
  • Constructor Details

    • PropertyUtil

      public PropertyUtil()
  • Method Details

    • extractName

      public static String extractName(String fqname)
      Extract the simple name of a property. Examples:
       .com.foo.Bar => Bar .X => X
       
      Parameters:
      fqname - a fully-qualified property name
      Returns:
      null on error
    • extractNs

      public static String extractNs(String fqname)
      Extract the namespace of a property. Examples:
       .com.foo.Bar => .com.foo
       .X => (empty string)
       
      Parameters:
      fqname - a fully-qualified property name
      Returns:
      null on error
    • levelUp

      public static String levelUp(String fqname)
      Generate the fully-qualified name of a similarly-named property one namespace above the current property name namespace. Examples:
       .com.foo.Bar => .com.Bar
       .X => null (error)
       
      Parameters:
      fqname - a fully-qualified property name
      Returns:
      null on error
    • getRoot

      Retrieve the root of a PDM tree from any PDM in that tree.
      Parameters:
      pdm -
      Returns:
    • getNamespace

      public static IPropertyDefinitionManager getNamespace(IPropertyDefinitionManager pdm, String namespace)
      Retrieve a namespace.
      Parameters:
      pdm - a root or non-root PDM
      namespace - a relative or fully-qualified region or sub-region name, eg ".com.pnf.abc", "com.pnf", pnf.abc.def", etc.
      Returns:
      the PDM of the provided region, null on error
    • getDefinition

      public static IPropertyDefinition getDefinition(IPropertyDefinitionManager pdm, String fqname)
      Retrieve a property from a fully-qualified name
      Parameters:
      pdm - any PDM
      fqname - a fully-qualified property name, which must start with '.'
      Returns:
      the definition or null
    • formatList

      public static String formatList(IPropertyDefinitionManager pdm, boolean alphasort)
      Print the list of properties defined by the provided PDM and its descendants (not the ascendants).
      Parameters:
      alphasort -
      Returns:
    • formatTree

      public static String formatTree(IPropertyDefinitionManager pdm, boolean alphasort)
      Print a tree view of properties defined by the provided PDM and its descendants (not the ascendants).
      Parameters:
      pdm -
      alphasort -
      Returns:
    • convertSelectionId

      public static <V extends Enum<V>> V convertSelectionId(int id, Class<V> cl)
      Convenience method used to convert a selection id into an enumerated constant.
      Type Parameters:
      V -
      Parameters:
      id -
      cl -
      Returns:
      the enum whose ordinal matches the provided id, or null on error
    • convertSelectionId

      public static <V extends Enum<V>> V convertSelectionId(int id, Class<V> cl, V def)
      Convenience method used to convert a selection id into an enumerated constant.
      Type Parameters:
      V -
      Parameters:
      id -
      cl -
      def -
      Returns:
      the enum whose ordinal matches the provided id, or the default value on error
    • hasDescendants

      public static boolean hasDescendants(IPropertyDefinitionManager pdm)
      Determine whether a PDM has descendant properties.
      Parameters:
      pdm -
      Returns:
    • hasDescendants

      public static boolean hasDescendants(IPropertyDefinitionManager pdm, int mustHaveFlags, int cantHaveFlags)
      Determine whether a PDM has descendant properties (modulo the provided criteria).
      Parameters:
      pdm -
      mustHaveFlags -
      cantHaveFlags -
      Returns:
    • getSizeHint

      public static PropertyInputSizeHint getSizeHint(int flags)
      Retrieve a hint regarding the visual size of a property, from the property flags.
      Parameters:
      flags -
      Returns: