hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: Smart Translator - Class type
Date Wed, 14 Jul 2004 17:14:40 GMT
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 <khoehn@etranscor.com>
Date: Wed, 14 Jul 2004 12:30:50 -0400
Subject: Smart Translator - Class type
To: hivemind-user@jakarta.apache.org

















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: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message