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

de.opitzconsulting.orcas.extensions.OrcasBaseExtensionWithParameter Maven / Gradle / Ivy

package de.opitzconsulting.orcas.extensions;

import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public abstract class OrcasBaseExtensionWithParameter implements OrcasExtensionWithParameter
{
  private String _parameter;

  public void setParameter( String pParameter )
  {
    _parameter = pParameter;
  }

  public String getParameterAsString()
  {
    return _parameter;
  }  

  public Map getParameterAsMap()
  {
    Map lReturn = new HashMap();
    String lString = getParameterAsString();

    lString = lString.replace( "[", "" );
    lString = lString.replace( "]", "" );

    StringTokenizer lStringTokenizerEntries = new StringTokenizer( lString, "," );
    while( lStringTokenizerEntries.hasMoreTokens() )
    {
      StringTokenizer lStringTokenizerValues = new StringTokenizer( lStringTokenizerEntries.nextToken(), ":" );

      lReturn.put( lStringTokenizerValues.nextToken(), lStringTokenizerValues.nextToken() );
    }

    return lReturn;
  }  

  public String getParameterAsMap( String pKey )
  {
    return getParameterAsMap().get( pKey );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy