Skip to content

Commit 243a30a

Browse files
committed
Entity toString for extended classes
1 parent 4ad4e21 commit 243a30a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

chartLib/src/main/kotlin/info/appdev/charting/data/BarEntry.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ open class BarEntry : Entry {
216216
}
217217
}
218218

219+
override fun toString(): String {
220+
return super.toString() + " yVals=" + yVals.contentToString()
221+
}
222+
219223
companion object {
220224
/**
221225
* Calculates the sum across all values of the given stack.

chartLib/src/main/kotlin/info/appdev/charting/data/Entry.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package info.appdev.charting.data
22

33
import android.graphics.drawable.Drawable
4+
import android.os.Build
45
import android.os.Parcel
56
import android.os.ParcelFormatException
67
import android.os.Parcelable
@@ -100,7 +101,11 @@ open class Entry : BaseEntry, Parcelable, Serializable {
100101
* returns a string representation of the entry containing x-index and value
101102
*/
102103
override fun toString(): String {
103-
return "Entry x=$x y=$y"
104+
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
105+
"${this.javaClass.typeName.substringAfterLast(".")} x=$x y=$y"
106+
} else {
107+
"Entry x=$x y=$y"
108+
}
104109
}
105110

106111
override fun describeContents(): Int {

0 commit comments

Comments
 (0)