For future reference, here is the fix.  I found it by looking at the
source for BeanModelSourceImpl.java:

    BeanModel toReturn = _beanModelSource.create( MyClass.class, false, 
        _componentResources );

    toReturn.exclude( (String[])toReturn.getPropertyNames()
        .toArray( new String[0] ) );
                
    PropertyConduit pc = _propertyConduitSource.create( MyClass.class,
        "pstlCode" );
    ClassPropertyAdapter cpa =
        _propertyAccess.getAdapter( MyClass.class );
    PropertyAdapter pa = cpa.getPropertyAdapter( "pstlCode" );
    String dataType = _dataTypeAnalyzer.identifyDataType( pa );

    toReturn.add( "pstlCode", pc ).dataType( dataType );

    return( toReturn );

In the above example, the following were all injected:

    _beanModelSource
    _componentResources
    _propertyConduitSource
    _propertyAccess
    _dataTypeAnalyzer

On Wed, 2008-07-02 at 03:34 -0400, Andy Huhn wrote:
> Hello,
> 
> I have a class defined (MyClass) that has a String property pstlCode,
> with a getter and a setter.
> 
> If I use BeanModelSource to create a BeanModel for MyClass, the
> BeanModel has a property pstlCode that can be used to access the
> pstlCode.
> 
> However, if I exclude the pstlCode property, and then attempt to add it
> back in with
> 
>     myBeanModel.exclude( "pstlCode" );
>     myBeanModel.add( "pstlCode" );
> 
> it doesn't seem to pick up the data type of the property.  Help?
> 
> Thanks,
> Andy



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

Reply via email to