I need to create a instance of ScanOptions. The correct code as below.
String pattern = "mykeyprefix_*";
Long cnt = 2000L;
ScanOptions options = ScanOptions.scanOptions().match(pattern).count(cnt).build();
My question is why not just use constructor to create object directly?
scanOptions = new ScanOptions(parttern, cnt);
Or use object Factory to create instance?
options = ScanOptionsFactory.create(parttern, cnt);
So is there any benefit to design code as first case? Could you please explain for me in detailed? thank you very much! here is the spring source code:
org.springframework.data.redis.core.ScanOptions
Aucun commentaire:
Enregistrer un commentaire