hlship      2004/06/09 07:51:47

  Modified:    framework/src/java/org/apache/hivemind/schema
                        SchemaProcessor.java
               framework/src/java/org/apache/hivemind/schema/rules
                        ReadAttributeRule.java
  Log:
  All the read-attribute rule to override the attribute's translator.
  
  Revision  Changes    Path
  1.4       +7 -1      
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/SchemaProcessor.java
  
  Index: SchemaProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/SchemaProcessor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaProcessor.java      19 May 2004 15:08:47 -0000      1.3
  +++ SchemaProcessor.java      9 Jun 2004 14:51:47 -0000       1.4
  @@ -87,4 +87,10 @@
        */
   
       public Translator getAttributeTranslator(String attributeName);
  +    
  +    /**
  +     * Returns the named [EMAIL PROTECTED] 
org.apache.hivemind.schema.Translator}.
  +     */
  +    
  +    public Translator getTranslator(String translator);
   }
  
  
  
  1.8       +14 -3     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java
  
  Index: ReadAttributeRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ReadAttributeRule.java    5 Jun 2004 19:09:12 -0000       1.7
  +++ ReadAttributeRule.java    9 Jun 2004 14:51:47 -0000       1.8
  @@ -39,17 +39,19 @@
       private String _attributeName;
       private String _propertyName;
       private boolean _skipIfNull = true;
  +    private String _translator;
   
       public ReadAttributeRule()
       {
       }
   
  -    public ReadAttributeRule(String attributeName, String propertyName, 
Location location)
  +    public ReadAttributeRule(String attributeName, String propertyName, 
String translator, Location location)
       {
           setLocation(location);
   
           _attributeName = attributeName;
           _propertyName = propertyName;
  +        _translator = translator;
       }
   
       public void begin(SchemaProcessor processor, Element element)
  @@ -65,7 +67,10 @@
   
           try
           {
  -            Translator t = processor.getAttributeTranslator(_attributeName);
  +            Translator t =
  +                _translator == null
  +                    ? processor.getAttributeTranslator(_attributeName)
  +                    : processor.getTranslator(_translator);
   
               Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
   
  @@ -112,4 +117,10 @@
       {
           _skipIfNull = b;
       }
  +
  +    public void setTranslator(String string)
  +    {
  +        _translator = string;
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to