All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.plexus.util.interpolation.EnvarBasedValueSource Maven / Gradle / Ivy

Go to download

A collection of various utility classes to ease working with strings, files, command lines, XML and more.

There is a newer version: 4.0.2
Show newest version
package org.codehaus.plexus.util.interpolation;

import org.codehaus.plexus.util.cli.CommandLineUtils;

import java.io.IOException;
import java.util.Properties;

public class EnvarBasedValueSource
    implements ValueSource
{
    
    private Properties envars;

    public EnvarBasedValueSource() throws IOException
    {
        this.envars = CommandLineUtils.getSystemEnvVars();
    }

    public Object getValue( String expression )
    {
        String expr = expression;
        
        if ( expr.startsWith( "env." ) )
        {
            expr = expr.substring( "env.".length() );
        }
        
        return envars.getProperty( expr );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy