01: /*
02: * Copyright 2007 Bastian Schenke Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
05: * Unless required by applicable law or agreed to in writing, software distributed under the
06: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
07: * either express or implied. See the License for the specific language governing permissions
08: * and limitations under the License.
09: */
10: package nz.org.take.r2ml;
11:
12: import nz.org.take.Constant;
13: import de.tu_cottbus.r2ml.PlainLiteral;
14:
15: /**
16: * @author Bastian Schenke (bastian.schenke@googlemail.com)
17: *
18: */
19: class PlainLiteralHandler implements XmlTypeHandler {
20:
21: /**
22: * Maps a PlainLiteral to a Constant.
23: *
24: * TODO implement protected String languageTag;
25: * TODO implement protected String typeCategory;
26: *
27: * @param obj
28: * a PlainLiteral
29: * @return Constant representing the literal
30: *
31: * @see nz.org.take.r2ml.XmlTypeHandler#importObject(java.lang.Object,
32: * nz.org.take.r2ml.R2MLDriver)
33: */
34: public Object importObject(Object obj) throws R2MLException {
35: Constant constant = new Constant();
36: PlainLiteral pl = (PlainLiteral) obj;
37: constant.setObject(pl.getLexicalValue());
38: constant.setType(String.class);
39: constant.addAnnotation(PLAIN_LITERAL_LANGUAGE_TAG_KEY, pl
40: .getLanguageTag());
41: return constant;
42: }
43:
44: }
|