This whole check and all code related to it can be removed. The data model implementation checks if the prefix is correct and will throw an exception otherwise. You could catch this exception if you want to act on it (we might also use a more specific exception type to report this error; currently it is an IllegalArgumentException, which is not even checked).