Class PropertyUtil
java.lang.Object
com.pnfsoftware.jeb.core.properties.impl.PropertyUtil
Utility routines for properties, property managers, and property definition managers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V extends Enum<V>>
VconvertSelectionId
(int id, Class<V> cl) Convenience method used to convert a selection id into an enumerated constant.static <V extends Enum<V>>
VconvertSelectionId
(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
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 namestatic IPropertyDefinitionManager
getNamespace
(IPropertyDefinitionManager pdm, String namespace) Retrieve a namespace.static IPropertyDefinitionManager
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
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
Generate the fully-qualified name of a similarly-named property one namespace above the current property name namespace.
-
Constructor Details
-
PropertyUtil
public PropertyUtil()
-
-
Method Details
-
extractName
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
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
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 PDMnamespace
- 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
Retrieve a property from a fully-qualified name- Parameters:
pdm
- any PDMfqname
- a fully-qualified property name, which must start with '.'- Returns:
- the definition or null
-
formatList
Print the list of properties defined by the provided PDM and its descendants (not the ascendants).- Parameters:
alphasort
-- Returns:
-
formatTree
Print a tree view of properties defined by the provided PDM and its descendants (not the ascendants).- Parameters:
pdm
-alphasort
-- Returns:
-
convertSelectionId
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
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
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
Retrieve a hint regarding the visual size of a property, from the property flags.- Parameters:
flags
-- Returns:
-