/** * {@inheritDoc} */ public ObjectCreateRule get() { return new ObjectCreateRule(this.clazz); }
@Override public Object createObject(Attributes attributes) { String className = attributes.getValue("classname"); String attrName = attributes.getValue("attrname"); return (attrName == null || attrName.length() == 0) ? new ObjectCreateRule( className) : new ObjectCreateRule( className, attrName); } }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param className Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String className) { addRule(pattern, new ObjectCreateRule(className)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param clazz Java class to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(clazz)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param className Default Java class name to be created * @param attributeName Attribute name that optionally overrides * the default Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String className, String attributeName) { addRule(pattern, new ObjectCreateRule(className, attributeName)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param attributeName Attribute name that optionally overrides * @param clazz Default Java class to be created * the default Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String attributeName, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(attributeName, clazz)); }
public Object createObject(Attributes attributes) { String className = attributes.getValue("classname"); String attrName = attributes.getValue("attrname"); return (attrName == null || attrName.length() == 0) ? new ObjectCreateRule( className) : new ObjectCreateRule( className, attrName); } }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param clazz Java class to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(clazz)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param className Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String className) { addRule(pattern, new ObjectCreateRule(className)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param className Default Java class name to be created * @param attributeName Attribute name that optionally overrides * the default Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String className, String attributeName) { addRule(pattern, new ObjectCreateRule(className, attributeName)); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param attributeName Attribute name that optionally overrides * @param clazz Default Java class to be created * the default Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String attributeName, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(attributeName, clazz)); }
/** * Add Digester rules for all <onentry> and <onexit> * elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The {@link PathResolver} for this document * @param customActions The list of custom actions this digester needs * to be able to process */ private static void addHandlerRules(final String xp, final ExtendedBaseRules scxmlRules, final PathResolver pr, final List customActions) { scxmlRules.add(xp + XPF_ONEN, new ObjectCreateRule(OnEntry.class)); addActionRules(xp + XPF_ONEN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEN, new SetNextRule("setOnEntry")); scxmlRules.add(xp + XPF_ONEX, new ObjectCreateRule(OnExit.class)); addActionRules(xp + XPF_ONEX, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEX, new SetNextRule("setOnExit")); }
/** * Add Digester rules for all <onentry> and <onexit> * elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The {@link PathResolver} for this document * @param customActions The list of custom actions this digester needs * to be able to process */ private static void addHandlerRules(final String xp, final ExtendedBaseRules scxmlRules, final PathResolver pr, final List customActions) { scxmlRules.add(xp + XPF_ONEN, new ObjectCreateRule(OnEntry.class)); addActionRules(xp + XPF_ONEN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEN, new SetNextRule("setOnEntry")); scxmlRules.add(xp + XPF_ONEX, new ObjectCreateRule(OnExit.class)); addActionRules(xp + XPF_ONEX, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEX, new SetNextRule("setOnExit")); }
/** * Add Digester rules for all <datamodel> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addDatamodelRules(final String xp, final ExtendedBaseRules scxmlRules, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(Datamodel.class)); scxmlRules.add(xp + XPF_DATA, new ObjectCreateRule(Data.class)); scxmlRules.add(xp + XPF_DATA, new SetPropertiesRule()); scxmlRules.add(xp + XPF_DATA, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_DATA, new SetNextRule("addData")); try { scxmlRules.add(xp + XPF_DATA, new ParseDataRule(pr)); } catch (ParserConfigurationException pce) { org.apache.commons.logging.Log log = LogFactory. getLog(SCXMLDigester.class); log.error(ERR_PARSER_CFG_DATA, pce); } scxmlRules.add(xp, new SetNextRule("setDatamodel")); }
/** * Add Digester rules for all <datamodel> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addDatamodelRules(final String xp, final ExtendedBaseRules scxmlRules, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(Datamodel.class)); scxmlRules.add(xp + XPF_DATA, new ObjectCreateRule(Data.class)); scxmlRules.add(xp + XPF_DATA, new SetPropertiesRule()); scxmlRules.add(xp + XPF_DATA, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_DATA, new SetNextRule("addData")); try { scxmlRules.add(xp + XPF_DATA, new ParseDataRule(pr)); } catch (ParserConfigurationException pce) { org.apache.commons.logging.Log log = LogFactory. getLog(SCXMLParser.class); log.error(ERR_PARSER_CFG_DATA, pce); } scxmlRules.add(xp, new SetNextRule("setDatamodel")); }
/** * Add Digester rules for all <initial> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInitialRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Initial.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("setInitial")); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add Digester rules for all <initial> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInitialRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Initial.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("setInitial")); }
/** * Add Digester rules for all <invoke> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of {@link CustomAction}s this digester * instance will process, can be null or empty * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInvokeRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Invoke.class)); scxmlRules.add(xp, new SetPropertiesRule()); scxmlRules.add(xp, new SetCurrentNamespacesRule()); scxmlRules.add(xp, new SetPathResolverRule(pr)); scxmlRules.add(xp + XPF_PRM, new ObjectCreateRule(Param.class)); scxmlRules.add(xp + XPF_PRM, new SetPropertiesRule()); scxmlRules.add(xp + XPF_PRM, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_PRM, new SetNextRule("addParam")); scxmlRules.add(xp + XPF_FIN, new ObjectCreateRule(Finalize.class)); scxmlRules.add(xp + XPF_FIN, new UpdateFinalizeRule()); addActionRules(xp + XPF_FIN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_FIN, new SetNextRule("setFinalize")); scxmlRules.add(xp, new SetNextRule("setInvoke")); }