Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.mahout.common.parameters;
 
 import  org.apache.hadoop.mapred.JobConf;
 
 
 public abstract class AbstractParameter<T> implements Parameter<T> {
 
   private T value;
   private final String prefix;
   private final String name;
   private final String description;
   private final Class<T> type;
   private final String defaultValue;
 
   @Override
   public void configure(JobConf jobConf) {
     // nothing to do    
   }
 
   @Override
   public void createParameters(String prefix, JobConf jobConf) {
   }
 
   @Override
   public String getStringValue() {
     if ( == null) {
       return null;
     }
     return .toString();
   }
 
   @Override
   public Collection<Parameter<?>> getParameters() {
     return Collections.emptyList();
   }
 
   protected AbstractParameter(Class<T> typeString prefixString name, JobConf jobConf, T defaultValueString description) {
     this. = type;
     this. = name;
     this. = description;
 
     this. = defaultValue;
     this. = getStringValue();
 
     this. = prefix;
     String jobConfValue = jobConf.get(prefix + name);
     if (jobConfValue != null) {
       setStringValue(jobConfValue);
     }
 
   }
 
   @Override
   public String prefix() {
     return ;
   }
 
   @Override
   public String name() {
     return ;
   }
 
   @Override
   public String description() {
     return ;
   }
 
   @Override
   public Class<T> type() {
     return ;
   }
 
   @Override
   public String defaultValue() {
     return ;
   }
 
   @Override
   public T get() {
     return ;
  }
  public void set(T value) {
    this. = value;
  }
  public String toString() {
    if ( != null) {
      return .toString();
    } else {
      return super.toString();
    }
  }
New to GrepCode? Check out our FAQ X