public class

PropertyUtil

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

Class Overview

Utility routines for properties, property managers, and property definition managers.

Summary

Public Constructors
PropertyUtil()
Public Methods
static <V extends Enum<V>> V convertSelectionId(int id, Class<V> cl)
Convenience method used to convert a selection id into an enumerated constant.
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.
static String extractName(String fqname)
Extract the simple name of a property.
static String extractNs(String fqname)
Extract the namespace of a property.
static String formatList(IPropertyDefinitionManager pdm, boolean alphasort)
Print the list of properties defined by the provided PDM and its descendants (not the ascendants).
static String formatTree(IPropertyDefinitionManager pdm, boolean alphasort)
Print a tree view of properties defined by the provided PDM and its descendants (not the ascendants).
static IPropertyDefinition getDefinition(IPropertyDefinitionManager pdm, String fqname)
Retrieve a property from a fully-qualified name
static IPropertyDefinitionManager getNamespace(IPropertyDefinitionManager pdm, String namespace)
Retrieve a namespace.
static IPropertyDefinitionManager getRoot(IPropertyDefinitionManager pdm)
Retrieve the root of a PDM tree from any PDM in that tree.
static PropertyInputSizeHint getSizeHint(int flags)
Retrieve a hint regarding the visual size of a property, from the property flags.
static boolean hasDescendants(IPropertyDefinitionManager pdm)
Determine whether a PDM has descendant properties.
static boolean hasDescendants(IPropertyDefinitionManager pdm, int mustHaveFlags, int cantHaveFlags)
Determine whether a PDM has descendant properties (modulo the provided criteria).
static String levelUp(String fqname)
Generate the fully-qualified name of a similarly-named property one namespace above the current property name namespace.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PropertyUtil ()

Public Methods

public static V convertSelectionId (int id, Class<V> cl)

Convenience method used to convert a selection id into an enumerated constant.

Returns
  • the enum whose ordinal matches the provided id, or null on error

public static V convertSelectionId (int id, Class<V> cl, V def)

Convenience method used to convert a selection id into an enumerated constant.

Returns
  • the enum whose ordinal matches the provided id, or the default value on error

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

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

public static String formatList (IPropertyDefinitionManager pdm, boolean alphasort)

Print the list of properties defined by the provided PDM and its descendants (not the ascendants).

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).

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

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

public static IPropertyDefinitionManager getRoot (IPropertyDefinitionManager pdm)

Retrieve the root of a PDM tree from any PDM in that tree.

public static PropertyInputSizeHint getSizeHint (int flags)

Retrieve a hint regarding the visual size of a property, from the property flags.

public static boolean hasDescendants (IPropertyDefinitionManager pdm)

Determine whether a PDM has descendant properties.

public static boolean hasDescendants (IPropertyDefinitionManager pdm, int mustHaveFlags, int cantHaveFlags)

Determine whether a PDM has descendant properties (modulo the provided criteria).

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