Closed tiwanari closed 7 years ago
Doesn't the validation work correctly too?
No, thank you for pointing out that!
Your suggestion is quite reasonable. Will do:)
I did:)
Ah, I meant that why not add the default value to the definition of MachinePreference like
@Table(name = "machine_preferences")
public class MachinePreferencesSchema {
// ...
@Key(name = "bluetooth_address")
String macAddress = "";
// ...
But calling getMacAddress()
with providing a default argument also makes sense and might be enough.
It's up to you whether adding the default value to the class definition or not.
Ah, sorry for my misunderstanding.. Hmm, in this case, both of them are reasonable but this kind of bugs is easily made and confusing. I guess this is a good time to start using guava which has useful methods like isNullOrEmpty
. What do you think?
I think it's natural the method returns null
(that's why the bug was made ) and returning ""
as well (in the Java world). So, using the until method, we don't have to specify the default value from my viewpoint.
Introducing guava is fine to me. But I think there are a lot of lines we can refactor by using the library and I want to replace such lines at a time.
So can you close this pull request? And let's discuss the library and list up the lines in another issue or pull request.
okay, after modifying lines you mentioned, I'll close this and raise an issue
I found a small but fatal bug.
The validation of a MAC address is wrong. If the string is not set,
""
will be returned not null.