Skip to content

Package: SimpleEndPoint

SimpleEndPoint

nameinstructionbranchcomplexitylinemethod
SimpleEndPoint()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEndPoint()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEndPoint(Exchange, Object, String, Map)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getRegex()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
matches(Exchange, Object, String, Map)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setEndPoint(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setRegex(String)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
toLog(StringBuffer, String)
M: 31 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.broker.core.router;
14:
15: import java.util.Map;
16: import java.util.regex.Pattern;
17:
18: import javax.xml.bind.annotation.XmlAccessType;
19: import javax.xml.bind.annotation.XmlAccessorType;
20: import javax.xml.bind.annotation.XmlRootElement;
21: import javax.xml.bind.annotation.XmlTransient;
22: import javax.xml.bind.annotation.XmlType;
23:
24: import org.apache.camel.Exchange;
25:
26: @XmlRootElement(name = "simpleEndPoint")
27: @XmlAccessorType(XmlAccessType.PROPERTY)
28: @XmlType(propOrder = {
29: "regex",
30: "endPoint"
31: })
32: public class SimpleEndPoint implements EndPoint {
33:
34: @XmlTransient
35: private Pattern pattern;
36: @XmlTransient
37: private String regexPlaceholderReplaced;
38:
39: private String regex;
40: private String endPoint;
41:
42: @Override
43: @XmlTransient
44: public boolean matches(Exchange exchange, Object value, String previous, Map<String, Object> properties) {
45: return EndpointsUtil.matches(exchange, value, previous, properties, pattern);
46: }
47:
48: @Override
49: @XmlTransient
50: public String getEndPoint(Exchange exchange, Object value, String previous, Map<String, Object> properties) {
51: return endPoint;
52: }
53:
54: public String getRegex() {
55: return regex;
56: }
57:
58: public void setRegex(String regex) {
59: this.regex = regex;
60: regexPlaceholderReplaced = EndPoint.replacePlaceholder(regex);
61: pattern = EndPoint.parseRegex(regexPlaceholderReplaced);
62: }
63:
64: public String getEndPoint() {
65: return endPoint;
66: }
67:
68: public void setEndPoint(String endPoint) {
69: this.endPoint = endPoint;
70: }
71:
72: @Override
73: public void toLog(StringBuffer buffer, String prefix) {
74: buffer.append("Regex: ");
75: buffer.append(regexPlaceholderReplaced);
76: buffer.append("\n");
77: buffer.append(prefix);
78: buffer.append("\t");
79: buffer.append("End point: ");
80: buffer.append(endPoint);
81: }
82:
83: }