java - How to set own model to an interface which get generic types parameters -
this interface ,
public interface onsendentitymessagelistener { public <t> void onsendentity(class<t> entitytype, t message); } when want use interface below , build-in error
the method onsendentity(class, t) in type afragment.onsendentitymessagelistener not applicable arguments (class, string)
private void sendasamplemessagetoparent(account account) { msendentity.onsendentity(account.class, "fragment message. : "+ account.getname()); } modal
public class account { string name; public string getname() { return name; } public void setname(string name) { name = name; } } thanks helps
you have defined parameter message t in interface. t type argument in example bound type account when you're invoking
msendentity.onsendentity(account.class, "fragment message. : "+ account.getname()); you might have meant declare method
public <t> void onsendentity(class<t> entitytype, string message); instead.
Comments
Post a Comment