/*
* XML 2 Java Binding (X2JB) - the excellent Java tool.
* Copyright 2009, by Richard Opalka.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not see the FSF site:
* http://www.fsf.org/ and search for the LGPL License document there.
*/
package test.sample.valid;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.x2jb.bind.spi.handler.ElementHandler;
import test.org.x2jb.bind.Helper;
import test.sample.valid.CustomHandler4.A;
/**
* Custom handler, it is used for testing purposes only
*
* @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
*/
public final class CustomHandler4Impl implements ElementHandler
{
public CustomHandler4Impl()
{
super();
}
public Object bind( final Element e, final Class< ? > c )
{
final NodeList nl = e.getElementsByTagNameNS( "http://r/cfg/", "testArray1" );
final String[] converted = new String[ nl.getLength() ];
for ( int i = 0; i < converted.length; i++ )
{
converted[ i ] = new String( Helper.getTextContent( nl.item( i ) ).toLowerCase() );
}
final A retVal = new A()
{
public String[] getValues()
{
return converted;
}
};
return retVal;
}
public Object getDefault( final String defaultValue, final Class< ? > clazz )
{
return null;
}
}