org.nuiton.eugene.models.object.xml.DigesterObjectModelRuleSet Maven / Gradle / Ivy
/*
* #%L
* EUGene :: EUGene
*
* $Id: DigesterObjectModelRuleSet.java 863 2010-04-15 14:22:49Z tchemit $
* $HeadURL: http://svn.nuiton.org/svn/eugene/tags/eugene-2.1.1/eugene/src/main/java/org/nuiton/eugene/models/object/xml/DigesterObjectModelRuleSet.java $
* %%
* Copyright (C) 2004 - 2010 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package org.nuiton.eugene.models.object.xml;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.RuleSetBase;
/**
* DigesterObjectModelRuleSet
*
* Definit principalement :
* - la classe d'implementation a utiliser pour chaque noeud
* - la methode a appeler apres chaque noeud
*
* Ce jeu de regle ne cree pas l'element racine.
* Il doit etre cree et ajoute a la pile digester avant l'appel a
* Digester.parse(File).
*
* Exemple:
*
* ObjectModel monModel = new ObjectModelImpl()
* Digester d = new Digester();
* d.push(monModel);
* d.parse(file);
*
*
* @author chatellier
* @version $Revision: 863 $
*
* Last update : $Date: 2010-04-15 16:22:49 +0200 (jeu., 15 avril 2010) $
* By : */
public class DigesterObjectModelRuleSet extends RuleSetBase {
protected String prefix;
public DigesterObjectModelRuleSet() {
this("");
}
public DigesterObjectModelRuleSet(String prefix) {
this.prefix = prefix;
namespaceURI = "http://www.codelutin.org/lutingenerator/objectModel";
}
@Override
public void addRuleInstances(Digester d) {
//d.addFactoryCreate("objectModel", DigesterObjectModelFactory.class);
// root element must be present on stask
d.addSetProperties("objectModel");
d.addObjectCreate("objectModel/class", ObjectModelClassImpl.class);
d.addSetProperties("objectModel/class");
d.addSetNext("objectModel/class", "addClass");
d.addObjectCreate("objectModel/class/class", ObjectModelClassImpl.class);
d.addSetProperties("objectModel/class/class");
d.addSetNext("objectModel/class/class", "addInnerClassifier");
d.addObjectCreate("objectModel/interface",
ObjectModelInterfaceImpl.class);
d.addSetProperties("objectModel/interface");
d.addSetNext("objectModel/interface", "addInterface");
d.addObjectCreate("objectModel/enumeration",
ObjectModelEnumerationImpl.class);
d.addSetProperties("objectModel/enumeration");
d.addSetNext("objectModel/enumeration", "addEnumeration");
d.addObjectCreate("objectModel/enumeration/literal",
ObjectModelImplRef.class);
d.addSetProperties("objectModel/enumeration/literal");
d.addSetNext("objectModel/enumeration/literal", "addLiteral");
d.addObjectCreate("objectModel/associationClass",
ObjectModelAssociationClassImpl.class);
d.addSetProperties("objectModel/associationClass");
d.addSetNext("objectModel/associationClass", "addAssociationClass");
d.addObjectCreate("*/participant",
ObjectModeImplAssociationClassParticipant.class);
d.addSetProperties("*/participant");
d.addSetNext("*/participant", "addParticipant");
d.addObjectCreate("*/stereotype", ObjectModelImplRef.class);
d.addSetProperties("*/stereotype");
d.addSetNext("*/stereotype", "addStereotype");
d.addObjectCreate("*/dependency", ObjectModelDependencyImpl.class);
d.addSetProperties("*/dependency");
d.addSetNext("*/dependency", "addDependency");
d.addObjectCreate("*/attribute", ObjectModelAttributeImpl.class);
d.addSetProperties("*/attribute");
d.addSetNext("*/attribute", "addAttribute");
d.addObjectCreate("*/interface", ObjectModelImplRef.class);
d.addSetProperties("*/interface");
d.addSetNext("*/interface", "addInterface");
d.addObjectCreate("*/superclass", ObjectModelImplSuperClassRef.class);
d.addSetProperties("*/superclass");
d.addSetNext("*/superclass", "addSuperclass");
d.addObjectCreate("*/operation", ObjectModelOperationImpl.class);
d.addSetProperties("*/operation");
d.addSetNext("*/operation", "addOperation");
d.addObjectCreate("*/operation/returnParameter",
ObjectModelParameterImpl.class);
d.addSetProperties("*/operation/returnParameter");
d.addSetNext("*/operation/returnParameter", "setReturnParameter");
d.addObjectCreate("*/operation/parameter",
ObjectModelParameterImpl.class);
d.addSetProperties("*/operation/parameter");
d.addSetNext("*/operation/parameter", "addParameter");
d.addObjectCreate("*/operation/exceptionParameter",
ObjectModelParameterImpl.class);
d.addSetProperties("*/operation/exceptionParameter");
d.addSetNext("*/operation/exceptionParameter", "addExceptionParameter");
d.addObjectCreate("*/tagValue", ObjectModelImplTagValue.class);
d.addSetProperties("*/tagValue");
d.addSetNext("*/tagValue", "addTagValue");
d.addObjectCreate("*/comment", String.class);
d.addSetProperties("*/comment");
d.addSetNext("*/comment", "addComment");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy