1 /* 2 * Copyright 2007 Werner Guttmann 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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 package org.exolab.castor.builder.conflict.strategy; 17 18 import org.exolab.castor.xml.schema.Annotated; 19 import org.exolab.javasource.JClass; 20 21 /** 22 * Class name conflict resolver. 23 * 24 * @author <a href="mailto:werner DOT guttmann AT gmx DOT net">Werner Guttmann</a> 25 */ 26 public class XPATHClassNameConflictResolver 27 extends BaseClassNameConflictResolver 28 implements ClassNameConflictResolver { 29 30 /** 31 * Changes the JClass' internal class name, as a result of an XPATH 32 * expression uniquely identifying an XML artefact within an XML schema. 33 * 34 * @param jClass 35 * The {@link JClass} instance whose local name should be 36 * changed. 37 * @param xpath 38 * XPATH expression used to defer the new local class name 39 * @param typedXPath 40 * typed XPATH expression used to defer the new local class name 41 * @param annotated {@link Annotated} instance 42 */ 43 public void changeClassInfoAsResultOfConflict(final JClass jClass, 44 final String xpath, final String typedXPath, final Annotated annotated) { 45 // set new classname 46 String newClassName = calculateXPathPrefix(xpath) + jClass.getLocalName(); 47 jClass.changeLocalName(newClassName); 48 } 49 50 51 }