Java 类org.eclipse.core.commands.AbstractParameterValueConverter 实例源码

项目:birt    文件:CommandUtils.java   
public static Parameterization createParameter( Command command,
        String parameterId, Object value ) throws NotDefinedException,
        ExecutionException, ParameterValueConversionException
{
    ParameterType parameterType = command.getParameterType( parameterId );
    if ( parameterType == null )
    {
        throw new ExecutionException( "Command does not have a parameter type for the given parameter" ); //$NON-NLS-1$
    }

    IParameter param = command.getParameter( parameterId );
    AbstractParameterValueConverter valueConverter = parameterType.getValueConverter( );
    if ( valueConverter == null )
    {
        throw new ExecutionException( "Command does not have a value converter" ); //$NON-NLS-1$
    }

    String valueString = valueConverter.convertToString( value );
    Parameterization parm = new Parameterization( param, valueString );
    return parm;
}