Top Description Fields Constructors Methods
org.freedesktop.dbus.connections

public Class BusAddress

extends Object
Class Inheritance
Imports
org.freedesktop.dbus.exceptions.InvalidBusAddressException, org.slf4j.Logger, .LoggerFactory, java.util.*, java.util.stream.Collectors

Defines an address to connect to DBus. The address will define which transport to use.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final Map<String, String>
private String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public BusAddress

Returns:

this
addParameter
(String
parameter name
_parameter
,
String
value
_value
)

Add a parameter to the address.

public String

Returns:

type
getBusType
()

Returns the transport type in uppercase.

public String
public BusAddress

Returns:

new BusAddress or this
getListenerAddress
()

Creates a listening BusAddress if this instance is not already listening.

public String

Returns:

String or null
getParameterValue
(String
parameter to get value for
_parameter
)

Returns a the value of the given parameter.

public String

Returns:

String or default
getParameterValue
(String
parameter to get value for
_parameter
,
String
default to return if parameter not set
_default
)

Returns a the value of the given parameter.

public String

Returns:

type
getType
()

Returns the transport type as found in the address.

public boolean

Returns:

true if parameter exists, false otherwise
hasParameter
(String
parameter to check
_parameter
)

Checks if the given parameter is present.

public boolean

Returns:

true if same type (case-insensitive), false if null or not same type
isBusType
(String
to compare
_type
)

Checks if this BusAddress is for the given bus type.

public boolean

Returns:

true if listening
isListeningSocket
()

True if this is a listening address.

public boolean

Returns:

true if server
isServer
()

True if this address represents a listening server address.

public static BusAddress

Returns:

BusAddress
of
(BusAddress
address to copy
_address
)

Creates a copy of the given BusAddress.

public static BusAddress

Returns:

BusAddress
of
(String
address String, never null or empty
_address
)

Creates a new BusAddress from String.

public BusAddress

Returns:

this
removeParameter
(String
parameter to remove
_parameter
)

Remove parameter with given name.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
parametersback to summary
private final Map<String, String> parameters
typeback to summary
private String type

Constructor Detail

BusAddressback to summary
protected BusAddress(BusAddress _obj)

Method Detail

addParameterback to summary
public BusAddress addParameter(String _parameter, String _value)

Add a parameter to the address. Adding multiple parameters with same name is not possible and will overwrite previous values.

Parameters
_parameter:String

parameter name

_value:String

value

Returns:BusAddress

this

Since
4.2.0 - 2022-07-18
getBusTypeback to summary
public String getBusType()

Returns the transport type in uppercase.

Returns:String

type

getGuidback to summary
public String getGuid()
getListenerAddressback to summary
public BusAddress getListenerAddress()

Creates a listening BusAddress if this instance is not already listening.

Returns:BusAddress

new BusAddress or this

Since
4.2.0 - 2022-07-18
getParameterValueback to summary
public String getParameterValue(String _parameter)

Returns a the value of the given parameter.

When no value present, null is returned.

Parameters
_parameter:String

parameter to get value for

Returns:String

String or null

Since
4.2.0 - 2022-07-19
getParameterValueback to summary
public String getParameterValue(String _parameter, String _default)

Returns a the value of the given parameter.

When no value present, the given default is returned.

Parameters
_parameter:String

parameter to get value for

_default:String

default to return if parameter not set

Returns:String

String or default

Since
4.2.2 - 2023-01-11
getTypeback to summary
public String getType()

Returns the transport type as found in the address.

Returns:String

type

hasParameterback to summary
public boolean hasParameter(String _parameter)

Checks if the given parameter is present.

Parameters
_parameter:String

parameter to check

Returns:boolean

true if parameter exists, false otherwise

Since
4.2.2 - 2023-01-11
isBusTypeback to summary
public boolean isBusType(String _type)

Checks if this BusAddress is for the given bus type.
The given type will be compared case-insensitive.
e.g.

isBusType("unix");
Parameters
_type:String

to compare

Returns:boolean

true if same type (case-insensitive), false if null or not same type

Since
4.2.0 - 2022-07-20
isListeningSocketback to summary
public boolean isListeningSocket()

True if this is a listening address.

Returns:boolean

true if listening

isServerback to summary
public boolean isServer()

True if this address represents a listening server address.

Returns:boolean

true if server

ofback to summary
public static BusAddress of(BusAddress _address)

Creates a copy of the given BusAddress. If given address is null, an empty BusAddress object is created.

Parameters
_address:BusAddress

address to copy

Returns:BusAddress

BusAddress

Since
4.2.0 - 2022-07-18
ofback to summary
public static BusAddress of(String _address)

Creates a new BusAddress from String.

Parameters
_address:String

address String, never null or empty

Returns:BusAddress

BusAddress

Since
4.2.0 - 2022-07-18
removeParameterback to summary
public BusAddress removeParameter(String _parameter)

Remove parameter with given name. If parameter does not exists, nothing will happen.

Parameters
_parameter:String

parameter to remove

Returns:BusAddress

this

Since
4.2.0 - 2022-07-18
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override