org.deckfour.xes.util
Class XAttributeUtils

java.lang.Object
  extended by org.deckfour.xes.util.XAttributeUtils

public class XAttributeUtils
extends Object

Utilities for working with attributes.

Author:
Christian W. Guenther (christian@deckfour.org)

Constructor Summary
XAttributeUtils()
           
 
Method Summary
static XAttribute composeAttribute(XFactory factory, String key, String value, String type, XExtension extension)
          Composes the appropriate attribute type from the string-based information found, e.g., in XML serializations.
static XAttribute derivePrototype(XAttribute instance)
          Derives a prototype for the given attribute.
static Set<XExtension> extractExtensions(Map<String,XAttribute> attributeMap)
          Static helper method for extracting all extensions from an attribute map.
static Class<? extends XAttribute> getType(XAttribute attribute)
          For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements.
static String getTypeString(XAttribute attribute)
          For the given attribute, derives the standardized string describing the attributes specific type (used, e.g., for serialization).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XAttributeUtils

public XAttributeUtils()
Method Detail

getType

public static Class<? extends XAttribute> getType(XAttribute attribute)
For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements.

Parameters:
attribute - Attribute to analyze.
Returns:
High-level type interface of this attribute.

getTypeString

public static String getTypeString(XAttribute attribute)
For the given attribute, derives the standardized string describing the attributes specific type (used, e.g., for serialization).

Parameters:
attribute - Attribute to extract type string from.
Returns:
String representation of the attribute's specific type.

derivePrototype

public static XAttribute derivePrototype(XAttribute instance)
Derives a prototype for the given attribute. This prototype attribute will be equal in all respects, expect for the value of the attribute. This value will be set to a default value, depending on the specific type of the given attribute.

Parameters:
instance - Attribute to derive prototype from.
Returns:
The derived prototype attribute.

composeAttribute

public static XAttribute composeAttribute(XFactory factory,
                                          String key,
                                          String value,
                                          String type,
                                          XExtension extension)
Composes the appropriate attribute type from the string-based information found, e.g., in XML serializations.

Parameters:
factory - Factory to use for creating the attribute.
key - Key of the attribute.
value - Value of the attribute.
type - Type string of the attribute.
extension - Extension of the attribute (can be null).
Returns:
An appropriate attribute.

extractExtensions

public static Set<XExtension> extractExtensions(Map<String,XAttribute> attributeMap)
Static helper method for extracting all extensions from an attribute map.

Parameters:
attributeMap - The attribute map from which to extract extensions.
Returns:
The set of extensions in the attribute map.