I am creating my own custom view. Since my logic is based on Tags, I need to check for the uniqueness of the tag value.
View has a function AddLabel (pTag as String, ....).
I need to prevent using the same Tag when calling:
xxxxx.AddLabel("tag1",...) repeatedly.
I can detect the duplicate in the GetAllViewsRecursive loop, but how do I pass it to the compiler? Passing it via message seems unsystematic to me. Or another solution?
Add a private map or list to your Customview.
Check this map or list when using AddLabel. Return an error if the tag is already available in the map/list.
Private Sub CheckDuplication (pTag As String)
If lTags.IndexOf(pTag) <> -1 Then 'check if tag exist in list
Dim TH As Throwables
TH.Initialize
TH.Throw(Throwables_Static.NewIllegalArgumentException("Duplicate tag: " & pTag))
End If
End Sub