Package org.apache.commons.digester

Examples of org.apache.commons.digester.SetPropertiesRule


         */
        public void begin(Attributes attributes) {
            String attrName = attributes.getValue("attr-name");
            String propName = attributes.getValue("prop-name");
   
            SetPropertiesRule rule = (SetPropertiesRule) digester.peek();
            rule.addAlias(attrName, propName);
        }
View Full Code Here


    {
    Rule rule = new PutAttributesRule(digestr,new String[]{NS_PREFIX+"key",NS_PREFIX+"property",NS_PREFIX+"baseSkin",NS_PREFIX+"skin",NS_PREFIX+"context"});
    digestr.addRule(pattern,rule);
    }
    {
    SetPropertiesRule rule = new SetPropertiesRule(new String[]{NS_PREFIX+"key",NS_PREFIX+"property",NS_PREFIX+"baseSkin",NS_PREFIX+"skin",NS_PREFIX+"context"},new String[]{"value","property","baseSkin","skin","context"});   
    digestr.addRule(pattern,rule);
    }
    // custom attribute <f:attribute name='style' (value='....' | property='style' | skin='paramName' | call='methodName' | utilCall='methodName') [notNull='true'] />
    pattern = ANY_PARENT+NS_PREFIX+ATTRIBUTE_TAG;
    digestr.addObjectCreate(pattern,AttributeElement.class);
    digestr.addSetNext(pattern,CHILD_METHOD);
    digestr.addSetProperties(pattern);
    // component clientId <f:id [f:required='true'] />
    // breakpoint <f:break name="name">
    pattern = ANY_PARENT+NS_PREFIX+BREAK_TAG;
    digestr.addObjectCreate(pattern,BreakPoint.class);
    digestr.addSetProperties(pattern);
    digestr.addSetNext(pattern,CHILD_METHOD);
    // conditional rendering  <f:if then="true">
    pattern = ANY_PARENT+NS_PREFIX+IF_TAG;
    digestr.addObjectCreate(pattern,IfElement.class);
    digestr.addSetProperties(pattern);
    digestr.addSetNext(pattern,CHILD_METHOD);
    // resources import <f:importResource src="...">
    pattern = ANY_PARENT+NS_PREFIX+IMPORT_RESOURCE_TAG;
    digestr.addFactoryCreate(pattern, new AbstractObjectCreationFactory() {

      public Object createObject(Attributes attributes) throws Exception {

        if (attributes == null) {
          throw new IllegalArgumentException("Attributes set is null for " +
              IMPORT_RESOURCE_TAG +
              " element. Can not obtain required 'src' attribute!");
        }
       
        String value = attributes.getValue("src");
        if (value == null || value.length() == 0) {
          throw new IllegalArgumentException("Missing required 'src' attribute for " +
              IMPORT_RESOURCE_TAG +
              " element!");
        }
       
        return new ImportResourceElement(value);
      }
     
    });
    digestr.addSetNext(pattern,CHILD_METHOD);
    // facet <u:insertFacet name="name">
    pattern = ANY_PARENT+NS_UTIL_PREFIX+FACET_TAG;
    digestr.addObjectCreate(pattern,FacetElement.class);
    digestr.addSetProperties(pattern);
    digestr.addSetNext(pattern,CHILD_METHOD);
   
    // childrens <u:insertChildren>
    pattern = ANY_PARENT+NS_UTIL_PREFIX+CHILDREN_TAG;
    digestr.addObjectCreate(pattern,ChildrensElement.class);
    digestr.addSetNext(pattern,CHILD_METHOD);
//    {
//      Rule rule = new PutAttributesRule(digestr,new String[]{NS_PREFIX+"key",NS_PREFIX+"property",NS_PREFIX+"skin",NS_PREFIX+"context"});
//      digestr.addRule(pattern,rule);
//      }
      {
      SetPropertiesRule rule = new SetPropertiesRule(new String[]{NS_PREFIX+"key",NS_PREFIX+"property",NS_PREFIX+"skin",NS_PREFIX+"context"},new String[]{"value","property","skin","context"});   
      digestr.addRule(pattern,rule);
      }


   
View Full Code Here

TOP

Related Classes of org.apache.commons.digester.SetPropertiesRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.