org.apache.commons.digester.Rule Java Examples
The following examples show how to use
org.apache.commons.digester.Rule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FromAnnotationsRuleSet.java From lams with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public void addRuleInstances(Digester digester) { String pattern; Rule rule; for (Entry<String, List<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>>> entry : this.rules.entrySet()) { pattern = entry.getKey(); for (AnnotationRuleProvider<Annotation, AnnotatedElement, Rule> provider : entry.getValue()) { rule = provider.get(); if (this.namespaceURI != null) { rule.setNamespaceURI(this.namespaceURI); } digester.addRule(pattern, rule); } } }
Example #2
Source File: FromAnnotationsRuleSet.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Retrieves a specific instance of the {@link AnnotationRuleProvider} for * the input pattern. * * @param <T> the {@link AnnotationRuleProvider} type * @param pattern the input pattern * @param providerClass the {@link AnnotationRuleProvider} class * @return an {@link AnnotationRuleProvider} for the input pattern if found, * null otherwise. */ public <T extends AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule>> T getProvider(String pattern, Class<T> providerClass) { if (!this.rules.containsKey(pattern)) { return null; } for (AnnotationRuleProvider<Annotation, AnnotatedElement, Rule> rule : this.rules.get(pattern)) { if (providerClass.isInstance(rule)) { return providerClass.cast(rule); } } return null; }
Example #3
Source File: PluginCreateRule.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Invoked by the digester when the closing tag matching this Rule's * pattern is encountered. * </p> * * @param namespace Description of the Parameter * @param name Description of the Parameter * @exception Exception Description of the Exception * * @see #begin */ @Override public void end(String namespace, String name) throws Exception { // see body method for more info String path = digester.getMatch(); PluginRules newRules = (PluginRules) digester.getRules(); List<Rule> rules = newRules.getDecoratedRules().match(namespace, path); fireEndMethods(rules, namespace, name); // pop the stack of PluginRules instances, which // discards all custom rules associated with this plugin digester.setRules(newRules.getParent()); // and get rid of the instance of the plugin class from the // digester object stack. digester.pop(); }
Example #4
Source File: PluginCreateRule.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Process the body text of this element. * * @param text The body text of this element */ @Override public void body(String namespace, String name, String text) throws Exception { // While this class itself has no work to do in the body method, // we do need to fire the body methods of all dynamically-added // rules matching the same path as this rule. During begin, we had // to manually execute the dynamic rules' begin methods because they // didn't exist in the digester's Rules object when the match begin. // So in order to ensure consistent ordering of rule execution, the // PluginRules class deliberately avoids returning any such rules // in later calls to the match method, instead relying on this // object to execute them at the appropriate time. // // Note that this applies only to rules matching exactly the path // which is also matched by this PluginCreateRule. String path = digester.getMatch(); PluginRules newRules = (PluginRules) digester.getRules(); List<Rule> rules = newRules.getDecoratedRules().match(namespace, path); fireBodyMethods(rules, namespace, name, text); }
Example #5
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object createObject(Attributes attributes) throws Exception { // create callparamrule int paramIndex = Integer.parseInt(attributes.getValue("paramnumber")); String attributeName = attributes.getValue("attrname"); String type = attributes.getValue("type"); String value = attributes.getValue("value"); Rule objectParamRule = null; // type name is requried if (type == null) { throw new RuntimeException("Attribute 'type' is required."); } // create object instance Object param = null; Class<?> clazz = Class.forName(type); if (value == null) { param = clazz.newInstance(); } else { param = ConvertUtils.convert(value, clazz); } if (attributeName == null) { objectParamRule = new ObjectParamRule(paramIndex, param); } else { objectParamRule = new ObjectParamRule(paramIndex, attributeName, param); } return objectParamRule; }
Example #6
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object createObject(Attributes attributes) { // create callparamrule int paramIndex = Integer.parseInt(attributes.getValue("paramnumber")); String attributeName = attributes.getValue("attrname"); String fromStack = attributes.getValue("from-stack"); String stackIndex = attributes.getValue("stack-index"); Rule callParamRule = null; if (attributeName == null) { if (stackIndex != null) { callParamRule = new CallParamRule( paramIndex, Integer.parseInt(stackIndex)); } else if (fromStack != null) { callParamRule = new CallParamRule( paramIndex, Boolean.valueOf(fromStack).booleanValue()); } else { callParamRule = new CallParamRule(paramIndex); } } else { if (fromStack == null) { callParamRule = new CallParamRule(paramIndex, attributeName); } else { // specifying both from-stack and attribute name is not allowed throw new RuntimeException( "Attributes from-stack and attrname cannot both be present."); } } return callParamRule; }
Example #7
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object createObject(Attributes attributes) { Rule callMethodRule = null; String methodName = attributes.getValue("methodname"); // Select which element is to be the target. Default to zero, // ie the top object on the stack. int targetOffset = 0; String targetOffsetStr = attributes.getValue("targetoffset"); if (targetOffsetStr != null) { targetOffset = Integer.parseInt(targetOffsetStr); } if (attributes.getValue("paramcount") == null) { // call against empty method callMethodRule = new CallMethodRule(targetOffset, methodName); } else { int paramCount = Integer.parseInt(attributes.getValue("paramcount")); String paramTypesAttr = attributes.getValue("paramtypes"); if (paramTypesAttr == null || paramTypesAttr.length() == 0) { callMethodRule = new CallMethodRule(targetOffset, methodName, paramCount); } else { String[] paramTypes = getParamTypes(paramTypesAttr); callMethodRule = new CallMethodRule( targetOffset, methodName, paramCount, paramTypes); } } return callMethodRule; }
Example #8
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object createObject(Attributes attributes) throws Exception { Rule beanPropertySetterRule = null; String propertyname = attributes.getValue("propertyname"); if (propertyname == null) { // call the setter method corresponding to the element name. beanPropertySetterRule = new BeanPropertySetterRule(); } else { beanPropertySetterRule = new BeanPropertySetterRule(propertyname); } return beanPropertySetterRule; }
Example #9
Source File: DigesterLoader.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Handles the current visited element and related annotation, invoking the * right handler putting the rule provider in the rule set. * * @param annotation the current visited annotation. * @param element the current visited element. */ @SuppressWarnings("unchecked") private <A extends Annotation, E extends AnnotatedElement, R extends Rule> void handle(A annotation, E element, FromAnnotationsRuleSet ruleSet) { Class<?> annotationType = annotation.annotationType(); // check if it is one of the @*.List annotation if (annotationType.isAnnotationPresent(DigesterRuleList.class)) { Annotation[] annotations = AnnotationUtils.getAnnotationsArrayValue(annotation); if (annotations != null && annotations.length > 0) { // if it is an annotations array, process them for (Annotation ptr : annotations) { handle(ptr, element, ruleSet); } } } else if (annotationType.isAnnotationPresent(DigesterRule.class)) { DigesterRule digesterRule = annotationType.getAnnotation(DigesterRule.class); if (DefaultLoaderHandler.class == digesterRule.handledBy()) { Class<? extends AnnotationRuleProvider<A, E, R>> providerType = (Class<? extends AnnotationRuleProvider<A, E, R>>) digesterRule.providedBy(); ruleSet.addRuleProvider(AnnotationUtils.getAnnotationPattern(annotation), providerType, annotation, element); } else { Class<? extends DigesterLoaderHandler<Annotation, AnnotatedElement>> handlerType = (Class<? extends DigesterLoaderHandler<Annotation, AnnotatedElement>>) digesterRule.handledBy(); DigesterLoaderHandler<Annotation, AnnotatedElement> handler = this.digesterLoaderHandlerFactory.newInstance(handlerType); // run! handler.handle(annotation, element, ruleSet); } } }
Example #10
Source File: PluginRules.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return a List of all registered Rule instances that match the specified * nodepath, or a zero-length List if there are no matches. If more * than one Rule instance matches, they <strong>must</strong> be returned * in the order originally registered through the <code>add()</code> * method. * <p> * @param namespaceURI Namespace URI for which to select matching rules, * or <code>null</code> to match regardless of namespace URI * @param path the path to the xml nodes to be matched. */ public List<Rule> match(String namespaceURI, String path) { Log log = LogUtils.getLogger(digester); boolean debug = log.isDebugEnabled(); if (debug) { log.debug( "Matching path [" + path + "] on rules object " + this.toString()); } List<Rule> matches; if ((mountPoint != null) && (path.length() <= mountPoint.length())) { if (debug) { log.debug( "Path [" + path + "] delegated to parent."); } matches = parent.match(namespaceURI, path); // Note that in the case where path equals mountPoint, // we deliberately return only the rules from the parent, // even though this object may hold some rules matching // this same path. See PluginCreateRule's begin, body and end // methods for the reason. } else { log.debug("delegating to decorated rules."); matches = decoratedRules.match(namespaceURI, path); } return matches; }
Example #11
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Register a new Rule instance matching a pattern which is constructed * by concatenating the pattern prefix with the given pattern. */ public void add(String pattern, Rule rule) { StringBuffer buffer = new StringBuffer(); buffer.append(prefix); if (!pattern.startsWith("/")) { buffer.append('/'); } buffer.append(pattern); delegate.add(buffer.toString(), rule); }
Example #12
Source File: ValidatorResources.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a <code>Rule</code> to handle <code>arg0-arg3</code> * elements. This will allow validation.xml files that use the * versions of the DTD prior to Validator 1.2.0 to continue * working. */ private void addOldArgRules(Digester digester) { // Create a new rule to process args elements Rule rule = new Rule() { @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { // Create the Arg Arg arg = new Arg(); arg.setKey(attributes.getValue("key")); arg.setName(attributes.getValue("name")); if ("false".equalsIgnoreCase(attributes.getValue("resource"))) { arg.setResource(false); } try { final int length = "arg".length(); // skip the arg prefix arg.setPosition(Integer.parseInt(name.substring(length))); } catch (Exception ex) { getLog().error("Error parsing Arg position: " + name + " " + arg + " " + ex); } // Add the arg to the parent field ((Field)getDigester().peek(0)).addArg(arg); } }; // Add the rule for each of the arg elements digester.addRule(ARGS_PATTERN + "0", rule); digester.addRule(ARGS_PATTERN + "1", rule); digester.addRule(ARGS_PATTERN + "2", rule); digester.addRule(ARGS_PATTERN + "3", rule); }
Example #13
Source File: FromAnnotationsRuleSet.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Register an {@link AnnotationRuleProvider} for a specific pattern. * * @param pattern the pattern has to be associated to the rule provider. * @param ruleProvider the provider that builds the digester rule. */ @SuppressWarnings("unchecked") public void addRuleProvider(String pattern, AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule> ruleProvider) { List<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>> rules; if (this.rules.containsKey(pattern)) { rules = this.rules.get(pattern); } else { rules = new ArrayList<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>>(); this.rules.put(pattern, rules); } rules.add((AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>) ruleProvider); }
Example #14
Source File: FromAnnotationsRuleSet.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Builds and register an {@link AnnotationRuleProvider} for a specific * pattern. * * @param <T> the {@link AnnotationRuleProvider} type. * @param pattern the pattern has to be associated to the rule provider. * @param klass the {@link AnnotationRuleProvider} type has to be instantiated. * @param annotation the current visited annotation. * @param element the current visited element. */ public <A extends Annotation, E extends AnnotatedElement, R extends Rule, T extends AnnotationRuleProvider<A, E, R>> void addRuleProvider(String pattern, Class<T> klass, A annotation, E element) { T annotationRuleProvider = this.digesterLoader.getAnnotationRuleProviderFactory().newInstance(klass); annotationRuleProvider.init(annotation, element); this.addRuleProvider(pattern, annotationRuleProvider); }
Example #15
Source File: MethodHandler.java From lams with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private <A extends Annotation, R extends Rule> void doHandle(A methodAnnotation, Annotation annotation, Method method, Class<?> type, FromAnnotationsRuleSet ruleSet) { if (annotation.annotationType().isAnnotationPresent(DigesterRule.class) && annotation.annotationType().isAnnotationPresent(CreationRule.class)) { ruleSet.addRules(type); DigesterRule digesterRule = methodAnnotation.annotationType().getAnnotation(DigesterRule.class); Class<? extends AnnotationRuleProvider<A, Method, R>> providerType = (Class<? extends AnnotationRuleProvider<A, Method, R>>) digesterRule.providedBy(); ruleSet.addRuleProvider(AnnotationUtils.getAnnotationPattern(annotation), providerType, methodAnnotation, method); } else if (annotation.annotationType().isAnnotationPresent(DigesterRuleList.class)) { // check if it is one of the *.List annotation Annotation[] annotations = AnnotationUtils.getAnnotationsArrayValue(annotation); if (annotations != null) { // if it is an annotations array, process them for (Annotation ptr : annotations) { this.doHandle(methodAnnotation, ptr, method, type, ruleSet); } } } }
Example #16
Source File: DefaultAnnotationRuleProviderFactory.java From lams with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public <T extends AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule>> T newInstance(Class<T> type) throws DigesterLoadingException { try { return type.newInstance(); } catch (Exception e) { throw new DigesterLoadingException("An error occurred while creating '" + type + "' instance", e); } }
Example #17
Source File: PluginRules.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Register a new Rule instance matching the specified pattern. * * @param pattern Nesting pattern to be matched for this Rule. * This parameter treats equally patterns that begin with and without * a leading slash ('/'). * @param rule Rule instance to be registered */ public void add(String pattern, Rule rule) { Log log = LogUtils.getLogger(digester); boolean debug = log.isDebugEnabled(); if (debug) { log.debug("add entry" + ": mapping pattern [" + pattern + "]" + " to rule of type [" + rule.getClass().getName() + "]"); } // allow patterns with a leading slash character if (pattern.startsWith("/")) { pattern = pattern.substring(1); } if (mountPoint != null && !pattern.equals(mountPoint) && !pattern.startsWith(mountPoint + "/")) { // This can only occur if a plugin attempts to add a // rule with a pattern that doesn't start with the // prefix passed to the addRules method. Plugins mustn't // add rules outside the scope of the tag they were specified // on, so refuse this. // alas, can't throw exception log.warn( "An attempt was made to add a rule with a pattern that" + "is not at or below the mountpoint of the current" + " PluginRules object." + " Rule pattern: " + pattern + ", mountpoint: " + mountPoint + ", rule type: " + rule.getClass().getName()); return; } decoratedRules.add(pattern, rule); if (rule instanceof InitializableRule) { try { ((InitializableRule)rule).postRegisterInit(pattern); } catch (PluginConfigurationException e) { // Currently, Digester doesn't handle exceptions well // from the add method. The workaround is for the // initialisable rule to remember that its initialisation // failed, and to throw the exception when begin is // called for the first time. if (debug) { log.debug("Rule initialisation failed", e); } // throw e; -- alas, can't do this return; } } if (debug) { log.debug("add exit" + ": mapped pattern [" + pattern + "]" + " to rule of type [" + rule.getClass().getName() + "]"); } }
Example #18
Source File: MonitorManager.java From iaf with Apache License 2.0 | 4 votes |
public void setDigesterRules(Digester d) { Rule attributeChecker=new AttributeCheckingRule(); d.addFactoryCreate("*/monitoring",new CreationFactory()); d.addSetProperties("*/monitoring"); d.addSetTop("*/monitoring","register"); d.addRule("*/monitoring", attributeChecker); d.addRule("*/monitoring/destinations",new DestinationCleanup()); d.addObjectCreate("*/destination","className",IMonitorAdapter.class); d.addSetProperties("*/destination"); d.addSetTop("*/destination","register"); d.addRule("*/destination", attributeChecker); d.addObjectCreate("*/destination/sender","className",ISender.class); d.addSetProperties("*/destination/sender"); d.addSetNext("*/destination/sender","setSender"); d.addRule("*/destination/sender", attributeChecker); d.addObjectCreate("*/monitor",Monitor.class); d.addSetProperties("*/monitor"); d.addSetTop("*/monitor","register"); d.addRule("*/monitor", attributeChecker); d.addObjectCreate("*/alarm",Trigger.class); d.addSetProperties("*/alarm"); d.addSetNext("*/alarm","registerAlarm"); d.addRule("*/alarm", attributeChecker); d.addCallMethod("*/alarm/events/event", "addEventCode", 0); d.addObjectCreate("*/clearing",Trigger.class); d.addSetProperties("*/clearing"); d.addSetNext("*/clearing","registerClearing"); d.addRule("*/clearing", attributeChecker); d.addCallMethod("*/clearing/events/event", "addEventCode", 0); d.addObjectCreate("*/trigger",Trigger.class); d.addSetProperties("*/trigger"); d.addSetNext("*/trigger","registerTrigger"); d.addRule("*/trigger", attributeChecker); d.addCallMethod("*/trigger/events/event", "addEventCode", 0); d.addObjectCreate("*/adapterfilter",AdapterFilter.class); d.addSetProperties("*/adapterfilter"); d.addSetNext("*/adapterfilter","registerAdapterFilter"); d.addRule("*/adapterfilter", attributeChecker); d.addSetNext("*/adapterfilter/sources","setFilteringToLowerLevelObjects"); d.addCallMethod("*/adapterfilter/sources/source", "registerSubOject", 0); }
Example #19
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 4 votes |
/** * This method passes through to the underlying Rules object. */ public List<Rule> match(String namespaceURI, String pattern) { return delegate.match(namespaceURI, pattern); }
Example #20
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 4 votes |
/** * This method passes through to the underlying Rules object. */ public List<Rule> rules() { return delegate.rules(); }
Example #21
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 4 votes |
/** * @deprecated Call match(namespaceURI,pattern) instead. */ @Deprecated public List<Rule> match(String pattern) { return delegate.match(pattern); }
Example #22
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Add to the given digester the set of Rule instances used to parse an XML * document defining Digester rules. When the digester parses an XML file, * it will add the resulting rules & patterns to the 'target digester' * that was passed in this RuleSet's constructor.<P> * If you extend this class to support additional rules, your implementation * should of this method should call this implementation first: i.e. * <code>super.addRuleInstances(digester);</code> */ @Override public void addRuleInstances(Digester digester) { final String ruleClassName = Rule.class.getName(); digester.register(DIGESTER_PUBLIC_ID, getDigesterRulesDTD()); digester.addRule("*/pattern", new PatternRule("value")); digester.addRule("*/include", new IncludeRule()); digester.addFactoryCreate("*/bean-property-setter-rule", new BeanPropertySetterRuleFactory()); digester.addRule("*/bean-property-setter-rule", new PatternRule("pattern")); digester.addSetNext("*/bean-property-setter-rule", "add", ruleClassName); digester.addFactoryCreate("*/call-method-rule", new CallMethodRuleFactory()); digester.addRule("*/call-method-rule", new PatternRule("pattern")); digester.addSetNext("*/call-method-rule", "add", ruleClassName); digester.addFactoryCreate("*/object-param-rule", new ObjectParamRuleFactory()); digester.addRule("*/object-param-rule", new PatternRule("pattern")); digester.addSetNext("*/object-param-rule", "add", ruleClassName); digester.addFactoryCreate("*/call-param-rule", new CallParamRuleFactory()); digester.addRule("*/call-param-rule", new PatternRule("pattern")); digester.addSetNext("*/call-param-rule", "add", ruleClassName); digester.addFactoryCreate("*/factory-create-rule", new FactoryCreateRuleFactory()); digester.addRule("*/factory-create-rule", new PatternRule("pattern")); digester.addSetNext("*/factory-create-rule", "add", ruleClassName); digester.addFactoryCreate("*/object-create-rule", new ObjectCreateRuleFactory()); digester.addRule("*/object-create-rule", new PatternRule("pattern")); digester.addSetNext("*/object-create-rule", "add", ruleClassName); digester.addFactoryCreate("*/node-create-rule", new NodeCreateRuleFactory()); digester.addRule("*/node-create-rule", new PatternRule("pattern")); digester.addSetNext("*/node-create-rule", "add", ruleClassName); digester.addFactoryCreate("*/set-properties-rule", new SetPropertiesRuleFactory()); digester.addRule("*/set-properties-rule", new PatternRule("pattern")); digester.addSetNext("*/set-properties-rule", "add", ruleClassName); digester.addRule("*/set-properties-rule/alias", new SetPropertiesAliasRule()); digester.addFactoryCreate("*/set-property-rule", new SetPropertyRuleFactory()); digester.addRule("*/set-property-rule", new PatternRule("pattern")); digester.addSetNext("*/set-property-rule", "add", ruleClassName); digester.addFactoryCreate("*/set-nested-properties-rule", new SetNestedPropertiesRuleFactory()); digester.addRule("*/set-nested-properties-rule", new PatternRule("pattern")); digester.addSetNext("*/set-nested-properties-rule", "add", ruleClassName); digester.addRule("*/set-nested-properties-rule/alias", new SetNestedPropertiesAliasRule()); digester.addFactoryCreate("*/set-top-rule", new SetTopRuleFactory()); digester.addRule("*/set-top-rule", new PatternRule("pattern")); digester.addSetNext("*/set-top-rule", "add", ruleClassName); digester.addFactoryCreate("*/set-next-rule", new SetNextRuleFactory()); digester.addRule("*/set-next-rule", new PatternRule("pattern")); digester.addSetNext("*/set-next-rule", "add", ruleClassName); digester.addFactoryCreate("*/set-root-rule", new SetRootRuleFactory()); digester.addRule("*/set-root-rule", new PatternRule("pattern")); digester.addSetNext("*/set-root-rule", "add", ruleClassName); }
Example #23
Source File: PluginRules.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Return the list of rules registered with this object, in the order * they were registered with this object. * <p> * Note that Rule objects stored in parent Rules objects are not * returned by this method. * * @return list of all Rule objects known to this Rules instance. */ public List<Rule> rules() { return decoratedRules.rules(); }
Example #24
Source File: PluginRules.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Return a List of all registered Rule instances that match the specified * nesting pattern, or a zero-length List if there are no matches. If more * than one Rule instance matches, they <strong>must</strong> be returned * in the order originally registered through the <code>add()</code> * method. * * @param path the path to the xml nodes to be matched. * * @deprecated Call match(namespaceURI,pattern) instead. */ @Deprecated public List<Rule> match(String path) { return (match(null, path)); }
Example #25
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Adds a rule the the target digester. After a rule has been created by * parsing the XML, it is added to the digester by calling this method. * Typically, this method is called via reflection, when executing * a SetNextRule, from the Digester that is parsing the rules XML. * @param rule a Rule to add to the target digester. */ public void add(Rule rule) { targetDigester.addRule( basePath + patternStack.toString(), rule); }
Example #26
Source File: FromAnnotationsRuleSet.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Returns the data structure the patterns/{@link AnnotationRuleProvider} * pairs. * * @return the data structure the patterns/{@link AnnotationRuleProvider} * pairs. */ private Map<String, List<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>>> getRules() { return this.rules; }
Example #27
Source File: AnnotationRuleProviderFactory.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Return an {@link AnnotationRuleProvider} instance of the specified type. * * @param <T> the {@link AnnotationRuleProvider} type. * @param type the class of the object to be returned. * @return an instance of the specified class. * @throws DigesterLoadingException if any error occurs while creating the * {@code type} instance. */ <T extends AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule>> T newInstance(Class<T> type) throws DigesterLoadingException;