/** * Converts an object to an attribute value. * * @param o * the object. * @return the attribute value. * @throws BeanException * if there was an error during the conversion. */ public static String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { return null; } final ValueConverter vc = ConverterRegistry.getInstance().getValueConverter( o.getClass() ); if ( vc == null ) { return null; } return vc.toAttributeValue( o ); }
final String original = elementConverter.toAttributeValue( o1 ); if ( original.length() == 0 ) { buffer.append( "\"\"" );
public String getPropertyAsString( final String name ) throws BeanException { final PropertySpecification ps = new PropertySpecification( name ); final PropertyDescriptor pd = properties.get( ps.getName() ); if ( pd == null ) { throw new BeanException( "No such property:" + name ); } final Object o = getPropertyForSpecification( ps ); if ( o == null ) { return null; } final ValueConverter vc = ConverterRegistry.getInstance().getValueConverter( o.getClass() ); if ( vc == null ) { throw new BeanException( "Unable to handle property of type " + o.getClass().getName() ); } return vc.toAttributeValue( o ); }