Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can someone understand what this Java syntax is doing? And also in what situation would someone use it?

public class UpdateDetails<REQ extends ReferenceRequest> extends ExecuteStep<Context, REQ> {

}

The syntax just feels very odd to me. I am not even sure what exactlty REQ is. I do not see that used anywhere else in the class.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

REQ is a generic type parameter.

It doesn’t have to be used in the UpdateDetails class. It is passed to the ExecuteStep super class, which might use it.

Suppose SomeReferenceRequest is a class that implements or extends ReferenceRequest.

You can instantiate your class with:

UpdateDetails<SomeReferenceRequest> details = new UpdateDetails<> ();

The super class ExecuteStep might have methods that return REQ or have REQ argument[s], or it might have instance variables of type REQ.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading