in dbus-java/src/main/java/org/freedesktop/dbus/connections/impl/DBusConnection.java [697:733]
public <I extends DBusInterface> I getRemoteObject(String _busname, String _objectpath, Class<I> _type,
boolean _autostart) throws DBusException {
if (null == _busname) {
throw new DBusException("Invalid bus name: null");
}
if (null == _objectpath) {
throw new DBusException("Invalid object path: null");
}
if (null == _type) {
throw new ClassCastException("Not A DBus Interface");
}
if ((!_busname.matches(BUSNAME_REGEX) && !_busname.matches(CONNID_REGEX)) || _busname.length() > MAX_NAME_LENGTH) {
throw new DBusException("Invalid bus name: " + _busname);
}
if (!_objectpath.matches(OBJECT_REGEX) || _objectpath.length() > MAX_NAME_LENGTH) {
throw new DBusException("Invalid object path: " + _objectpath);
}
if (!DBusInterface.class.isAssignableFrom(_type)) {
throw new ClassCastException("Not A DBus Interface");
}
// don't let people import things which don't have a
// valid D-Bus interface name
if (_type.getName().equals(_type.getSimpleName())) {
throw new DBusException("DBusInterfaces cannot be declared outside a package");
}
RemoteObject ro = new RemoteObject(_busname, _objectpath, _type, _autostart);
I i = (I) Proxy.newProxyInstance(_type.getClassLoader(), new Class[] {
_type
}, new RemoteInvocationHandler(this, ro));
getImportedObjects().put(i, ro);
return i;
}