【问题标题】:How to represent Android BluetoothCallback in UML classdiagram?如何在 UML 类图中表示 Android 蓝牙回调?
【发布时间】:2015-01-24 16:07:53
【问题描述】:

如何在类图中表示以下代码?

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
    }
};
}

我应该将它表示为一个内部类吗?

【问题讨论】:

    标签: android bluetooth callback uml class-diagram


    【解决方案1】:

    没有。这是一个属性,您应该这样显示它。只需添加一个名为 btleGattCallback 且类型为 BluetoothGattCallback 的属性。您可以继续创建一个对象图(这是一种类图,但用于实例)并将BluetoothGattCallback 对象嵌套在BluetoothClass 的实例中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-01
      • 1970-01-01
      相关资源
      最近更新 更多