public Conditionals addIfMatch ( Tag tag ) { Preconditions . checkArgument ( ! modifiedSince . isPresent ( ) , String . format ( ERROR_MESSAGE , HeaderConstants . IF_MATCH , HeaderConstants . IF_MODIFIED_SINCE ) ) ; Preconditions . checkArgument ( noneMatch . isEmpty ( ) , String . format ( ERROR_MESSAGE , HeaderConstants . IF_MATCH , HeaderConstants . IF_NONE_MATCH ) ) ; List < Tag > match = new ArrayList <> ( this . match ) ; if ( tag == null ) { tag = Tag . ALL ; } if ( Tag . ALL . equals ( tag ) ) { match . clear ( ) ; } if ( ! match . contains ( Tag . ALL ) ) { if ( ! match . contains ( tag ) ) { match . add ( tag ) ; } } else { throw new IllegalArgumentException ( "Tag ALL already in the list" ) ; } return new Conditionals ( Collections . unmodifiableList ( match ) , empty ( ) , Optional . empty ( ) , unModifiedSince ) ; }
Adds tags to the If - Match header .