1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.media;
|
10
|
|
11
|
import java.util.regex.Pattern;
|
12
|
|
13
|
public class SearchReplace {
|
14
|
|
15
|
private String replace;
|
16
|
private String search;
|
17
|
private Pattern searchPattern;
|
18
|
|
19
|
public SearchReplace() {
|
20
|
}
|
21
|
|
22
|
public SearchReplace(String search, String replace) {
|
23
|
this.search = search;
|
24
|
this.replace = replace;
|
25
|
}
|
26
|
|
27
|
public String getSearch() {
|
28
|
return search;
|
29
|
}
|
30
|
|
31
|
public String getReplace() {
|
32
|
return replace;
|
33
|
}
|
34
|
|
35
|
// not as property to avoid serialization
|
36
|
public Pattern searchPattern() {
|
37
|
if (searchPattern == null) {
|
38
|
searchPattern = Pattern.compile(search);
|
39
|
}
|
40
|
return searchPattern;
|
41
|
}
|
42
|
|
43
|
}
|