java - Can I prefix a function with "get" in Springboot -


i have mcq class associated mongorepository, , want instance of mcq apply several changes (answers shuffle, questions draw, etc). declared function "mymcq.getinstance()", can't because every time want send mcq in responseentity there error in json output because springboot thinks there "instance" property in class.

here java class :

@document(collection = "mcqs") public class mcq {     @id public string id;     @dbref public user creator;      public string title;     public string categoryid;     public list<mcqchapter> chapterlist = new arraylist<>();     public difficulty difficulty;      public mcq() {}      public mcq(string title) {         this();         this.title = title;     }      public arraylist<string> getquestionsids() {         arraylist<string> result = new arraylist<>();          (mcqchapter chapter : chapterlist) result.addall(chapter.getquestionids());          return result;     }       public mcqinstance getinstance() {         return new mcqinstance(this);     } } 

to prevent error add jsonignoretype getinstance():

@jsonignore  public mcqinstance getinstance() {     return new mcqinstance(this); } 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -