1
|
/**
|
2
|
* Copyright (C) 2018 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.vaadin.util;
|
10
|
|
11
|
import java.util.Vector;
|
12
|
|
13
|
import org.apache.commons.lang3.StringUtils;
|
14
|
|
15
|
/**
|
16
|
* @author a.kohlbecker
|
17
|
* @since May 18, 2018
|
18
|
*
|
19
|
*/
|
20
|
public class PropertyIdPath {
|
21
|
|
22
|
Vector propertyIds = new Vector<>();
|
23
|
|
24
|
public PropertyIdPath() {
|
25
|
|
26
|
}
|
27
|
|
28
|
/**
|
29
|
* @param propertyId
|
30
|
*/
|
31
|
public PropertyIdPath(Object propertyId) {
|
32
|
propertyIds.add(propertyId);
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
*
|
37
|
* @param propertyId
|
38
|
*/
|
39
|
public void addParent(Object propertyId){
|
40
|
propertyIds.add(0, propertyId);
|
41
|
}
|
42
|
|
43
|
public void addChild(Object propertyId){
|
44
|
propertyIds.add(propertyId);
|
45
|
}
|
46
|
|
47
|
@Override
|
48
|
public String toString(){
|
49
|
return StringUtils.join(propertyIds, ".");
|
50
|
}
|
51
|
|
52
|
public boolean matches(String propertyIdPath){
|
53
|
return toString().equals(propertyIdPath);
|
54
|
}
|
55
|
|
56
|
public boolean isEmpty(){
|
57
|
return propertyIds.isEmpty();
|
58
|
}
|
59
|
|
60
|
}
|