Class ConversionHelp
-
- All Implemented Interfaces:
public class ConversionHelp
Utility conversion routines for use with XStream
-
-
Constructor Summary
Constructors Constructor Description ConversionHelp()
-
Method Summary
Modifier and Type Method Description static String
encode(String p)
Encode a string (if necessary) for output to a JTL file. static String
decode(String p)
Decode a string if inVersion equals 1.0
static String
cdata(Array<byte> chars, String encoding)
Embed an array of bytes as a string with encoding
in a xml-cdata sectionstatic boolean
isSpecialProperty(String name)
Check whether name
specifies a special propertystatic String
getPropertyName(HierarchicalStreamReader reader, UnmarshallingContext context)
Get the property name, updating it if necessary using NameUpdater. static String
getPropertyValue(HierarchicalStreamReader reader, UnmarshallingContext context, String name)
Get the property value, updating it if necessary using NameUpdater. static String
getUpgradePropertyName(String name, UnmarshallingContext context)
Update a property name using NameUpdater. static String
getUpgradePropertyValue(String name, String value, UnmarshallingContext context)
Update a property value using getCurrentName. static void
saveSpecialProperties(TestElement testElement, HierarchicalStreamWriter writer)
Save the special properties: - TestElement.GUI_CLASS
- TestElement.TEST_CLASS
- TestElement.NAME
- TestElement.ENABLED
static void
restoreSpecialProperties(TestElement testElement, HierarchicalStreamReader reader)
Restore the special properties: - TestElement.GUI_CLASS
- TestElement.TEST_CLASS
- TestElement.NAME
- TestElement.ENABLED
static void
setInVersion(String v)
static void
setOutVersion(String v)
-
-
Method Detail
-
encode
static String encode(String p)
Encode a string (if necessary) for output to a JTL file. Strings are only encoded if the output version is 1.0, but nulls are always converted to the empty string.
- Parameters:
p
- string to encode- Returns:
encoded string (will never be null)
-
decode
static String decode(String p)
Decode a string if inVersion equals
1.0
- Parameters:
p
- the string to be decoded- Returns:
the newly decoded string
-
cdata
static String cdata(Array<byte> chars, String encoding)
Embed an array of bytes as a string with
encoding
in a xml-cdata section- Parameters:
chars
- bytes to be encoded and embeddedencoding
- the encoding to be used- Returns:
the encoded string embedded in a xml-cdata section
-
isSpecialProperty
static boolean isSpecialProperty(String name)
Check whether
name
specifies a special property- Parameters:
name
- the name of the property to be checked- Returns:
true
ifname
is the name of a special property
-
getPropertyName
static String getPropertyName(HierarchicalStreamReader reader, UnmarshallingContext context)
Get the property name, updating it if necessary using NameUpdater.
- Parameters:
reader
- where to read the name attributecontext
- the unmarshalling context- Returns:
the property name, may be null if the property has been deleted.
-
getPropertyValue
static String getPropertyValue(HierarchicalStreamReader reader, UnmarshallingContext context, String name)
Get the property value, updating it if necessary using NameUpdater. Do not use for GUI_CLASS or TEST_CLASS.
- Parameters:
reader
- where to read the valuecontext
- the unmarshalling contextname
- the name of the property- Returns:
the property value, updated if necessary.
-
getUpgradePropertyName
static String getUpgradePropertyName(String name, UnmarshallingContext context)
Update a property name using NameUpdater.
- Parameters:
name
- the original property namecontext
- the unmarshalling context- Returns:
the property name, may be null if the property has been deleted.
-
getUpgradePropertyValue
static String getUpgradePropertyValue(String name, String value, UnmarshallingContext context)
Update a property value using getCurrentName. Do not use for GUI_CLASS or TEST_CLASS.
- Parameters:
name
- the original property namevalue
- the original property valuecontext
- the unmarshalling context- Returns:
the property value, updated if necessary
-
saveSpecialProperties
static void saveSpecialProperties(TestElement testElement, HierarchicalStreamWriter writer)
Save the special properties:
- TestElement.GUI_CLASS
- TestElement.TEST_CLASS
- TestElement.NAME
- TestElement.ENABLED
- Parameters:
testElement
- element for which the special properties should be savedwriter
- HierarchicalStreamWriter in which the special properties should be saved
-
restoreSpecialProperties
static void restoreSpecialProperties(TestElement testElement, HierarchicalStreamReader reader)
Restore the special properties:
- TestElement.GUI_CLASS
- TestElement.TEST_CLASS
- TestElement.NAME
- TestElement.ENABLED
- Parameters:
testElement
- in which the special properties should be restoredreader
- HierarchicalStreamReader from which the special properties should be restored
-
setInVersion
static void setInVersion(String v)
-
setOutVersion
static void setOutVersion(String v)
-
-
-