01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.mapping.xsem;
18:
19: import org.compass.core.converter.Converter;
20: import org.compass.core.mapping.AbstractResourcePropertyMapping;
21: import org.compass.core.mapping.Mapping;
22: import org.compass.core.mapping.OverrideByNameMapping;
23: import org.compass.core.mapping.ResourcePropertyMapping;
24: import org.compass.core.xml.XmlXPathExpression;
25:
26: /**
27: * @author kimchy
28: */
29: public class XmlPropertyMapping extends AbstractResourcePropertyMapping
30: implements ResourcePropertyMapping, OverrideByNameMapping,
31: XPathEnabledMapping {
32:
33: private boolean overrideByName;
34:
35: private String xpath;
36:
37: private Converter valueConverter;
38:
39: private String valueConverterName;
40:
41: private XmlXPathExpression xpathExpression;
42:
43: public Mapping copy() {
44: XmlPropertyMapping xmlPropertyMapping = new XmlPropertyMapping();
45: copy(xmlPropertyMapping);
46: return xmlPropertyMapping;
47: }
48:
49: protected void copy(XmlPropertyMapping copy) {
50: super .copy(copy);
51: copy.setOverrideByName(isOverrideByName());
52: copy.setXPath(getXPath());
53: copy.setValueConverter(getValueConverter());
54: copy.setValueConverterName(getValueConverterName());
55: copy.setXPathExpression(getXPathExpression());
56: }
57:
58: public boolean isOverrideByName() {
59: return this .overrideByName;
60: }
61:
62: public void setOverrideByName(boolean overrideByName) {
63: this .overrideByName = overrideByName;
64: }
65:
66: public String getXPath() {
67: return xpath;
68: }
69:
70: public void setXPath(String xpath) {
71: this .xpath = xpath;
72: }
73:
74: public Converter getValueConverter() {
75: return valueConverter;
76: }
77:
78: public void setValueConverter(Converter valueConverter) {
79: this .valueConverter = valueConverter;
80: }
81:
82: public String getValueConverterName() {
83: return valueConverterName;
84: }
85:
86: public void setValueConverterName(String valueConverterName) {
87: this .valueConverterName = valueConverterName;
88: }
89:
90: public XmlXPathExpression getXPathExpression() {
91: return xpathExpression;
92: }
93:
94: public void setXPathExpression(XmlXPathExpression xpathExpression) {
95: this.xpathExpression = xpathExpression;
96: }
97: }
|