There is a class with methods. Code for example:
package helpers; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import java.util.Date; public class DateTimeHelper { /** * текущая дата */ private static final DateTime originalDate = new DateTime(new Date()); /** * получить текущую дату и время относительно запуска теста */ public DateTime getOriginalDate(){ return originalDate; } /** * Печать даты в требуемом формате * @param date дата которую надо напечатать * @param format формат печати * @return строку содержащую требуемую дату в требуемом формате */ public String printDateShortFormat(DateTime date,String format){ String pattern="yyyy"; switch (format){ case "standard": pattern = "dd.MM.yyyy' 'HH:mm"; break; case "full": // не задаём формат break; case "only-date": pattern = "dd.MM.yyyy"; break; case "only-time": pattern = "HH:mm"; break; default: throw new AssertionError("[ERROR] Не обрабатываемый формат"); } return DateTimeFormat.forPattern(pattern).print(date); } /** * Прибавление к дате дней * @param date дата * @param days количество дней добавляемых к дате * @return результат сложения */ public DateTime plusDays(DateTime date, int days){ return date.plusDays(days); } } I don't want to call methods like this
dateTimeHelper.printDateShortFormat( dateTimeHelper.plusDays(dateTimeHelper.getOriginalDate(),5 ), "standard" ); How to describe this class so that you can call methods in a similar way (pseudocode): How can you realize the situation where the value is returned and the next method takes this value as a parameter through a dot? example:
DateTimeHelper.getOriginalDate().plusDays(5).printDateShortFormat("standard") so generally possible?)