Package javolution.text

Examples of javolution.text.CharArray


    }

    private void readAttributes( final javolution.xml.XMLFormat.InputElement input, final T obj ) throws XMLStreamException {
        final Attributes attributes = input.getAttributes();
        for ( int i = 0; i < attributes.getLength(); i++ ) {
            final CharArray name = attributes.getLocalName( i );
            if ( !name.equals( "class" ) && !name.equals( JavolutionTranscoder.REFERENCE_ATTRIBUTE_ID ) ) {
                final Field field = _attributesMap.get( name.toString() );
                if ( field != null ) {
                    setFieldFromAttribute( obj, field, input );
                } else {
                    LOG.warn( "Did not find field " + name + ", attribute value is " + attributes.getValue( i ) );
                }
View Full Code Here


                    final Enum<?> enumValue = Enum.valueOf( fieldType.asSubclass( Enum.class ), value );
                    field.set( obj, enumValue );
                }
            } else {

                final CharArray object = input.getAttribute( fieldName );

                if ( object != null ) {
                    if ( fieldType == String.class ) {
                        field.set( obj, getAttribute( input, fieldName, (String) null ) );
                    } else if ( fieldType.isAssignableFrom( Boolean.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Boolean) null ) );
                        field.set( obj, getAttribute( input, fieldName, (Boolean) null ) );
                    } else if ( fieldType.isAssignableFrom( Integer.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Integer) null ) );
                    } else if ( fieldType.isAssignableFrom( Long.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Long) null ) );
                    } else if ( fieldType.isAssignableFrom( Short.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Short) null ) );
                    } else if ( fieldType.isAssignableFrom( Double.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Double) null ) );
                    } else if ( fieldType.isAssignableFrom( Float.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Float) null ) );
                    } else if ( fieldType.isAssignableFrom( Byte.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Byte) null ) );
                    } else if ( fieldType.isAssignableFrom( Character.class ) ) {
                        field.set( obj, getAttribute( input, fieldName, (Character) null ) );
                    } else if ( Number.class.isAssignableFrom( fieldType ) ) {
                        @SuppressWarnings( "unchecked" )
                        final XMLNumberFormat<?> format = getNumberFormat( (Class<? extends Number>) fieldType );
                        field.set( obj, format.newInstanceFromAttribute( input, fieldName ) );
                    } else if ( fieldType == Currency.class ) {
                        field.set( obj, Currency.getInstance( object.toString() ) );
                    } else {
                        throw new IllegalArgumentException( "Not yet supported as attribute: " + fieldType );
                    }
                }
            }
View Full Code Here

            }
        }
    }

    private String getAttribute( final InputElement input, final String name, final String defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? value.toString() : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? value.toString() : defaultValue;
    }

    private Boolean getAttribute( final InputElement input, final String name, final Boolean defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Boolean.valueOf( value.toBoolean() ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Boolean.valueOf( value.toBoolean() ) : defaultValue;
    }

    private Integer getAttribute( final InputElement input, final String name, final Integer defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Integer.valueOf( value.toInt() ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Integer.valueOf( value.toInt() ) : defaultValue;
    }

    private Long getAttribute( final InputElement input, final String name, final Long defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Long.valueOf( value.toLong() ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Long.valueOf( value.toLong() ) : defaultValue;
    }

    private Short getAttribute( final InputElement input, final String name, final Short defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Short.valueOf( TypeFormat.parseShort( value ) ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Short.valueOf( TypeFormat.parseShort( value ) ) : defaultValue;
    }

    private Float getAttribute( final InputElement input, final String name, final Float defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Float.valueOf( value.toFloat() ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Float.valueOf( value.toFloat() ) : defaultValue;
    }

    private Double getAttribute( final InputElement input, final String name, final Double defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Double.valueOf( value.toDouble() ) : defaultValue;
    }
View Full Code Here

        final CharArray value = input.getAttribute( name );
        return value != null ? Double.valueOf( value.toDouble() ) : defaultValue;
    }

    private Byte getAttribute( final InputElement input, final String name, final Byte defaultValue ) throws XMLStreamException {
        final CharArray value = input.getAttribute( name );
        return value != null ? Byte.valueOf( TypeFormat.parseByte( value ) ) : defaultValue;
    }
View Full Code Here

TOP

Related Classes of javolution.text.CharArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.