git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268597 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to byte converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToByteConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToByteConverter() | |||||
| { | |||||
| super( String.class, Byte.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Byte( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to class converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToClassConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToClassConverter() | |||||
| { | |||||
| super( String.class, Class.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return Class.forName( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to double converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToDoubleConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToDoubleConverter() | |||||
| { | |||||
| super( String.class, Double.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Double( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,35 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import java.io.File; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.ant.tasklet.TaskletContext; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to file converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToFileConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToFileConverter() | |||||
| { | |||||
| super( String.class, File.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| final TaskletContext taskletContext = (TaskletContext)context; | |||||
| return taskletContext.resolveFile( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to float converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToFloatConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToFloatConverter() | |||||
| { | |||||
| super( String.class, Float.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Float( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to integer converter. | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToIntegerConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToIntegerConverter() | |||||
| { | |||||
| super( String.class, Integer.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Integer( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to long converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToLongConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToLongConverter() | |||||
| { | |||||
| super( String.class, Long.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Long( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,32 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to short converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToShortConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToShortConverter() | |||||
| { | |||||
| super( String.class, Short.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new Short( (String)original ); | |||||
| } | |||||
| } | |||||
| @@ -1,33 +0,0 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE file. | |||||
| */ | |||||
| package org.apache.ant.convert.core; | |||||
| import java.net.URL; | |||||
| import org.apache.ant.convert.AbstractConverter; | |||||
| import org.apache.avalon.Context; | |||||
| /** | |||||
| * String to url converter | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class StringToURLConverter | |||||
| extends AbstractConverter | |||||
| { | |||||
| public StringToURLConverter() | |||||
| { | |||||
| super( String.class, URL.class ); | |||||
| } | |||||
| public Object convert( final Object original, final Context context ) | |||||
| throws Exception | |||||
| { | |||||
| return new URL( (String)original ); | |||||
| } | |||||
| } | |||||