-2
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.

srb
  • 9
  • 1
  • 4

2 Answers2

0

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.

Eran
  • 387,369
  • 54
  • 702
  • 768
0

UpdateDetails: The name of your class REQ: generic name for the class that UpdateDetails will process. Similar to when you write ArrayList you will build UpdateDetails. Someclass will need to extend the class ReferenceRequest.

ReferenceRequest: UpdateDetails can use any object that extends ReferenceRequest.

ExecuteStep: UpdateDetails will need to extend the class ExecuteStep, that will process two objects, Context and REQ.

You can learn more about generics here: https://docs.oracle.com/javase/tutorial/java/generics/

Luna
  • 155
  • 9