1 15 package org.apache.hivemind.schema.rules; 16 17 import org.apache.hivemind.Element; 18 import org.apache.hivemind.schema.SchemaProcessor; 19 import org.apache.hivemind.schema.Translator; 20 21 27 public class PushAttributeRule extends BaseRule 28 { 29 private String _attributeName; 30 31 35 public void begin(SchemaProcessor processor, Element element) 36 { 37 String attributeValue = element.getAttributeValue(_attributeName); 38 39 if (attributeValue == null) 40 attributeValue = processor.getAttributeDefault(_attributeName); 41 42 String value = RuleUtils.processText(processor, element, attributeValue); 43 44 Translator t = processor.getAttributeTranslator(_attributeName); 45 46 Object finalValue = t.translate( 47 processor.getContributingModule(), 48 Object .class, 49 value, 50 element.getLocation()); 51 52 processor.push(finalValue); 53 } 54 55 58 public void end(SchemaProcessor processor, Element element) 59 { 60 processor.pop(); 61 } 62 63 public void setAttributeName(String string) 64 { 65 _attributeName = string; 66 } 67 68 public String getAttributeName() 69 { 70 return _attributeName; 71 } 72 73 } 74 | Popular Tags |