package uk.ac.ebi.quickgo.rest.period;

/**
 * Interface for classes that interpret a String as a period definition.
 * @author Tony Wardell
 * Date: 25/04/2017
 * Time: 10:41
 * Created with IntelliJ IDEA.
 */
public interface PeriodParser {

    /**
     * Parse a String that contains a definition of a time period, to produce an instance of Period.
     * @param input String
     * @return instance of Period or null if no valid period could be parsed. Nulls are returned so parser can be
     * chained if necessary, any non-null values are therefore valid to be used.
     */
    Period parse(String input);
}

@@ -33,16 +33,44 @@
 eriod;%0A%0A
+import java.util.Optional;%0A%0A
 /**%0A * I
@@ -417,32 +417,44 @@
 return instance 
+an Optional 
 of Period or nul
@@ -450,19 +450,32 @@
 riod or 
-nul
+an empty Optiona
 l if no 
@@ -507,125 +507,8 @@
 sed.
- Nulls are returned so parser can be%0A     * chained if necessary, any non-null values are therefore valid to be used.
 %0A   
@@ -516,22 +516,32 @@
  */%0A    
+Optional%3C
 Period
+%3E
  parse(S

Replace ZeroDurationPeriod with use of Optional i.e. don't mix returning Period instances and nulls.