I'd rather add startup code to register a proper PropertyEditor with
the JavaBeans framework.  There's an extension point for this purpose
(hivemind.Startup).

Once the PropertyEditor is defined, it should "just work".

Better a solution for that, than to start introducing special cases
into the code.


----- Original Message -----
From: Kurt R. Hoehn <[EMAIL PROTECTED]>
Date: Wed, 14 Jul 2004 12:30:50 -0400
Subject: Smart Translator - Class type
To: [email protected]

















Hello,



 



    The interface that I'm implementing
has 2 getter methods that return type "Class" and it blows up every
time on the getXXXX method calls.  So I did some digging around with the Smart
Translator and there is no editor for type Class which is by design.



 



Is there a reason for the Smart Translator not supporting other
java fundamental types (i.e. Class)?  



 



I modified the  SmartTranslator.java  translate
method  and it seemed to work and it passed all Unit Tests.



 



public Object translate(Module
contributingModule, Class propertyType, String inputValue)



{



â



 



  if (e == null)



  {



    if( propertyType.getName().equals("java.lang.Class")
)



    {



      ClassResolver
resolver = contributingModule.getClassResolver();



      return
resolver.findClass(inputValue);



    }



    else



    {



        throw
new AplicationRuntimeException(RulesMessages.noPropertyEditor(propertyType));



    }



  }



 



â



}



 



My hivemodule.sdl



 



      service-point
( id=LockingConfiguration 



                     
interface=org.apache.ojb.odmg.locking.LockingConfiguration)



      {



            invoke-factory(
service-id=hivemind.BuilderFactory )



            {



                  construct
(class=com.etranscor.hivemind.ojb.configuration.LockingConfigurationImpl)



                  {



                     
set ( property=lockManagerClass value=${ojb.lockmanager.class} )    



                     
set ( property=lockMapClass     value=${ojb.lockmap.class}
)



                  }           



            }



      }



 



      contribution
(configuration-id=hivemind.FactoryDefaults)



      {



            default
(symbol=ojb.lockmanager.class 
value=org.apache.ojb.odmg.locking.LockManagerDefaultImpl)



            default
(symbol=ojb.lockmap.class     
value=org.apache.ojb.odmg.locking.InMemoryLockMapImpl)



      }



 



-kurt h



 










-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

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

Reply via email to