package com.continuuity.api.stream;

import java.util.Map;

/*
 * Specification for {@code Stream}
  */
public final class StreamSpecification {

  private long ttl;
  private long maxSize;
  private Map<String,String> metaData;
  private String name;


  private void setName(String name) {
    this.name = name;
  }

  private void setTTL(long ttl) {
    this.ttl = ttl;
  }


  private void setMaxSize (long maxSize) {
    this.maxSize = maxSize;
  }

  private void setMetaData (Map<String,String> metaData ) {
    this.metaData = metaData;
   }

  /*
   * Returns the name of the Stream
   */
  public String getName(){
    return this.name;
  }

  /*
   * Returns ttl of the Stream
   */
  public long getTTL() {
    return this.ttl;
  }


  /*
   * Returns the MaxSize of the stream
   */
  public long getMaxSize() {
    return this.maxSize;
  }


  /*
   * Returns metaData of the stream
   */
  public Map<String,String> getMetaData(){
    return this.metaData;
  }

  //Instantiate object using Builder
  private StreamSpecification(){}


  /*
  * {@code StreamSpecification} builder used to build specification of stream
  */
  public static final class Builder {

    private long ttl = -1 ;
    private long maxSize = -1 ;
    private Map<String,String> metaData;
    private String name;


    /*
     * Adds name parameter to Streams
     * @param name: stream name
     * @return Builder instance
     */
    public Builder setName(String name) {
      this.name = name;
      return this;
    }



    /*
     * Adds ttl parameter to Streams
     * @param ttl: time for streams to live -1 (default parameter) will enable to stream to live for ever
     * @return Builder instance
    */
    public Builder setTTL(long ttl) {
      this.ttl = ttl;
      return this;
    }


    /*
     *  Add maxSize to streams
     *  @param maxSize: maxSize to read from the stream -1 indicates there is no maxSize
     *  @return Builder instance
     */

    public Builder setMaxSize(long maxSize) {
      this.maxSize = maxSize;
      return this;
    }

    /*
     * Annotate metaData to Stream
     * @param metaData: MetaData to annotate the Stream
     * @return Builder instance
     */

    public Builder setMetaData (Map<String,String> metaData) {
      this.metaData = metaData;
      return this;
    }

    /*
     * Create {@code StreamSpecification}
     * @return object of {@code StreamSpecification}
     */
    public StreamSpecification create() {
      StreamSpecification specification = new StreamSpecification();
      specification.setName(name);
      specification.setMaxSize(this.maxSize);
      specification.setMetaData(this.metaData);
      specification.setTTL(this.ttl);
      return specification;
    }

  }  

}

@@ -34,31 +34,8 @@
 m;%0A%0A
-import java.util.Map;%0A%0A
 /*%0A 
@@ -120,91 +120,8 @@
  %7B%0A%0A
-  private long ttl;%0A  private long maxSize;%0A  private Map%3CString,String%3E metaData;%0A
   pr
@@ -212,662 +212,107 @@
 %0A%0A  
-private void setTTL(long ttl) %7B%0A    this.ttl = ttl;%0A  %7D%0A%0A%0A  private void setMaxSize (long maxSize) %7B%0A    this.maxSize = maxSize;%0A  %7D%0A%0A  private void setMetaData (Map%3CString,String%3E metaData ) %7B%0A    this.metaData = metaData;%0A   %7D%0A%0A  /*%0A   * Returns the name of the Stream%0A   */%0A  public String getName()%7B%0A    return this.name;%0A  %7D%0A%0A  /*%0A   * Returns ttl of the Stream%0A   */%0A  public long getTTL() %7B%0A    return this.ttl;%0A  %7D%0A%0A%0A  /*%0A   * Returns the MaxSize of the stream%0A   */%0A  public long getMaxSize() %7B%0A    return this.maxSize;%0A  %7D%0A%0A%0A  /*%0A   * Returns metaData of the stream%0A   */%0A  public Map%3CString,String%3E getMetaData()%7B%0A    return this.metaData;%0A  %7D
+/*%0A   * Returns the name of the Stream%0A   */%0A  public String getName()%7B%0A    return this.name;%0A  %7D%0A%0A
 %0A%0A  
@@ -513,109 +513,8 @@
  %7B%0A%0A
-    private long ttl = -1 ;%0A    private long maxSize = -1 ;%0A    private Map%3CString,String%3E metaData;%0A
     
@@ -750,816 +750,8 @@
 %7D%0A%0A%0A
-%0A    /*%0A     * Adds ttl parameter to Streams%0A     * @param ttl: time for streams to live -1 (default parameter) will enable to stream to live for ever%0A     * @return Builder instance%0A    */%0A    public Builder setTTL(long ttl) %7B%0A      this.ttl = ttl;%0A      return this;%0A    %7D%0A%0A%0A    /*%0A     *  Add maxSize to streams%0A     *  @param maxSize: maxSize to read from the stream -1 indicates there is no maxSize%0A     *  @return Builder instance%0A     */%0A%0A    public Builder setMaxSize(long maxSize) %7B%0A      this.maxSize = maxSize;%0A      return this;%0A    %7D%0A%0A    /*%0A     * Annotate metaData to Stream%0A     * @param metaData: MetaData to annotate the Stream%0A     * @return Builder instance%0A     */%0A%0A    public Builder setMetaData (Map%3CString,String%3E metaData) %7B%0A      this.metaData = metaData;%0A      return this;%0A    %7D%0A%0A
     
@@ -1006,140 +1006,8 @@
 e);%0A
-      specification.setMaxSize(this.maxSize);%0A      specification.setMetaData(this.metaData);%0A      specification.setTTL(this.ttl);%0A
     

Remove API parameters that are not used for now