public String toAttributeValue( final Object o ) throws BeanException { if ( o instanceof Enum == false ) { throw new BeanException(); } final Enum e = (Enum) o; return e.name(); }
public Object toPropertyValue( final String s ) throws BeanException { try { return Enum.valueOf( enumClass, s ); } catch ( Exception e ) { throw new BeanException( "Failed to convert enum from string " + s, e ); } } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof FontSmooth ) { return String.valueOf( o ); } else { throw new BeanException( "Invalid value specified for FontSmooth" ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o instanceof TextWrap ) { return String.valueOf( o ); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a TextWrap." ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o instanceof TextRotation ) { return String.valueOf( o ); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a TextRotation." ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o instanceof TextDirection ) { return String.valueOf( o ); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a TextWrap." ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof BoxSizing ) { return String.valueOf( o ); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a BoxSizing." ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof BorderStyle ) { return String.valueOf( o ); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a BorderStyle." ); } }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof VerticalTextAlign ) { return String.valueOf( o ); } throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a VerticalTextAlign." ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof WhitespaceCollapse ) { return String.valueOf( o ); } throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a WhitespaceCollapse." ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof Class ) { final Class c = (Class) o; return c.getName(); } throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a Class." ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof ElementAlignment ) { return String.valueOf( o ).toLowerCase(); } else { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a ElementAlignment." ); } }
public static Class getPropertyType( final PropertyDescriptor pd ) throws BeanException { final Class typeFromDescriptor = pd.getPropertyType(); if ( typeFromDescriptor != null ) { return typeFromDescriptor; } if ( pd instanceof IndexedPropertyDescriptor ) { final IndexedPropertyDescriptor idx = (IndexedPropertyDescriptor) pd; return idx.getIndexedPropertyType(); } throw new BeanException( "Unable to determine the property type." ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof Timestamp == false ) { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a SQL-Timestamp." ); } final DateFormat format = (DateFormat) dateFormat.clone(); return format.format( (Timestamp) o ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof Date == false ) { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a SQL-Date." ); } final DateFormat format = (DateFormat) dateFormat.clone(); return format.format( (Date) o ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof Time == false ) { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a SQL-Time." ); } final DateFormat format = (DateFormat) dateFormat.clone(); return format.format( (Time) o ); }
public String toAttributeValue( final Object o ) throws BeanException { if ( o == null ) { throw new NullPointerException(); } if ( o instanceof Date == false ) { throw new BeanException( "Failed to convert object of type " + o.getClass() + ": Not a Date." ); } final DateFormat format = (DateFormat) dateFormat.clone(); return format.format( (Date) o ); }
public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } try { final DateFormat format = (DateFormat) dateFormat.clone(); return format.parse( s ); } catch ( ParseException e ) { throw new BeanException( "Failed to parse date", e ); } } }
public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } try { final ClassLoader loader = ObjectUtilities.getClassLoader( ClassValueConverter.class ); return Class.forName( CompatibilityMapperUtil.mapClassName( s ), false, loader ); } catch ( Throwable e ) { throw new BeanException( "Specified class does not exist or cannot be loaded.", e ); } } }
public Class getPropertyType( final String name ) throws BeanException { if ( name == null ) { throw new NullPointerException( "Name must not be null" ); } final PropertySpecification ps = new PropertySpecification( name ); final PropertyDescriptor pd = properties.get( ps.getName() ); if ( pd == null ) { throw new BeanException( "No such property:" + name ); } return BeanUtility.getPropertyType( pd ); }