如何在UML类图中表示Android BluetoothCallback?
如何在类图中表示以下代码段如何在UML类图中表示Android BluetoothCallback?,android,bluetooth,callback,uml,class-diagram,Android,Bluetooth,Callback,Uml,Class Diagram,如何在类图中表示以下代码段 public class BluetoothClass{ public BluetoothClass(){ } private final BluetoothGattCallback btleGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(android.bluetooth.BluetoothGatt gatt, i
public class BluetoothClass{
public BluetoothClass(){
}
private final BluetoothGattCallback btleGattCallback = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(android.bluetooth.BluetoothGatt gatt, int status, int newState) {
super.onConnectionStateChange(gatt, status, newState);
//do something
}
@Override
public void onReadRemoteRssi(android.bluetooth.BluetoothGatt gatt, int rssi, int status) {
super.onReadRemoteRssi(gatt, rssi, status);
//do something
}
};
}
我是否应该将其表示为一个内部类?否。这是一个属性,您应该这样显示它。只需添加类型为
BluetoothGattCallback
的名为btLegatCallback的属性。您可以继续创建一个对象图(这有点像类图,但只针对实例),然后在BluetoothClass
的实例中嵌套BluetoothGattCallback
对象