summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/libvirt/domain/device/HostdevUtils.java
blob: 204bea92dca408e7a2bb3fbe62226c8babb0ed3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.openslx.libvirt.domain.device;

/**
 * Collection of helper methods to maintain a Libvirt related hostdev XML element.
 * 
 * @author Manuel Bentele
 * @version 1.0
 */
public class HostdevUtils
{
	/**
	 * Appends the HEX prefix to a specified hostdev address component without any HEX prefix.
	 * 
	 * @param component address component without any HEX prefix.
	 * @return address component with the HEX prefix.
	 */
	public static String appendHexPrefix( String component )
	{
		return "0x" + component;
	}

	/**
	 * Removes a possible HEX prefix of a specified hostdev address component.
	 * 
	 * @param component address component with possible HEX prefix.
	 * @return address component without any HEX prefix.
	 */
	public static String removeHexPrefix( String component )
	{
		return component.replaceFirst( "0x", "" );
	}
}