org.apache.mahout.common.parameters
Class AbstractParameter<T>

java.lang.Object
  extended by org.apache.mahout.common.parameters.AbstractParameter<T>
All Implemented Interfaces:
org.apache.hadoop.mapred.JobConfigurable, Parameter<T>, Parametered
Direct Known Subclasses:
ClassParameter, CompositeParameter, DoubleParameter, FileParameter, IntegerParameter, PathParameter, StringParameter

public abstract class AbstractParameter<T>
extends java.lang.Object
implements Parameter<T>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.mahout.common.parameters.Parametered
Parametered.ParameteredGeneralizations
 
Field Summary
 
Fields inherited from interface org.apache.mahout.common.parameters.Parametered
log
 
Constructor Summary
protected AbstractParameter(java.lang.Class<T> type, java.lang.String prefix, java.lang.String name, org.apache.hadoop.conf.Configuration jobConf, T defaultValue, java.lang.String description)
           
 
Method Summary
 void configure(org.apache.hadoop.mapred.JobConf jobConf)
           
 void createParameters(java.lang.String prefix, org.apache.hadoop.mapred.JobConf jobConf)
          EXPERT: consumers should never have to call this method.
 java.lang.String defaultValue()
           
 java.lang.String description()
           
 T get()
           
 java.util.Collection<Parameter<?>> getParameters()
           
 java.lang.String getStringValue()
           
 java.lang.String name()
           
 java.lang.String prefix()
           
 void set(T value)
           
 java.lang.String toString()
           
 java.lang.Class<T> type()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.mahout.common.parameters.Parameter
setStringValue
 

Constructor Detail

AbstractParameter

protected AbstractParameter(java.lang.Class<T> type,
                            java.lang.String prefix,
                            java.lang.String name,
                            org.apache.hadoop.conf.Configuration jobConf,
                            T defaultValue,
                            java.lang.String description)
Method Detail

configure

public void configure(org.apache.hadoop.mapred.JobConf jobConf)
Specified by:
configure in interface org.apache.hadoop.mapred.JobConfigurable

createParameters

public void createParameters(java.lang.String prefix,
                             org.apache.hadoop.mapred.JobConf jobConf)
Description copied from interface: Parametered
EXPERT: consumers should never have to call this method. It would be friendly visible to Parametered.ParameteredGeneralizations if java supported it. Calling this method should create a new list of parameters and is called

Specified by:
createParameters in interface Parametered
Parameters:
prefix - ends with a dot if not empty.
jobConf - configuration used for retreiving values
See Also:
invoking method, invoking method

getStringValue

public java.lang.String getStringValue()
Specified by:
getStringValue in interface Parameter<T>
Returns:
value string reprentation of current value

getParameters

public java.util.Collection<Parameter<?>> getParameters()
Specified by:
getParameters in interface Parametered

prefix

public java.lang.String prefix()
Specified by:
prefix in interface Parameter<T>
Returns:
job configuration setting key prefix, e.g. 'org.apache.mahout.util.WeightedDistanceMeasure.'

name

public java.lang.String name()
Specified by:
name in interface Parameter<T>
Returns:
configuration parameters name, e.g. 'weightsFile'

description

public java.lang.String description()
Specified by:
description in interface Parameter<T>
Returns:
human readable description of parameters

type

public java.lang.Class<T> type()
Specified by:
type in interface Parameter<T>
Returns:
value class type

defaultValue

public java.lang.String defaultValue()
Specified by:
defaultValue in interface Parameter<T>
Returns:
value used if not set by consumer

get

public T get()
Specified by:
get in interface Parameter<T>
Returns:
current parameters value

set

public void set(T value)
Specified by:
set in interface Parameter<T>
Parameters:
value - new parameters value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.