The answer to the old question, but the original poster asked what the line means, and not which alternatives can be used.
The line creates an instance of the IDfQuery implementation from the factory method in an instance of the object created by the static factory method in the DFCUtils class. This object is then assigned to a variable.
So: -
- DfcUtils = class containing the static getClientX () method
- getClientX () = static factory method that returns an instance of an object
- getQuery() = a factory ,
getClientX(), , IDfQuery;
- query = , IDfQuery
factory, / getQuery() . , , . , factory bootstrapper, .
, factory, , switch, , , IOC (Inversion of control): -
public static IDfQuery getQuery(){
IDfQuery returnValue;
switch ( getDayOfWeek() ) {
case "Monday" : returnValue = new MondayQuery(); break;
case "Tuesday" : returnValue = new TuesdayQuery(); break;
case "Wednesday" : returnValue = new WednesdayQuery(); break;
case "Thursday" : returnValue = new ThursdayQuery(); break;
case "Friday" : returnValue = new FridayQuery(); break;
case "Saturday" : returnValue = new SaturdayQuery(); break;
case "Sunday" : returnValue = new SundayQuery(); break;
default: returnValue = null; break;
}
return returnValue;
}
public static String getDayOfWeek(){
return new SimpleDateFormat("EEEE").format( new Date() );
}