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

org.apache.storm.tuple.Fields Maven / Gradle / Ivy

There is a newer version: 0.20.5-incubating
Show newest version
/**
 * 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.storm.tuple;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

public class Fields implements Iterable, Serializable {
  private static final long serialVersionUID = 4882556192519443356L;
  private org.apache.heron.api.tuple.Fields delegate;

  public Fields(String... fields) {
    delegate = new org.apache.heron.api.tuple.Fields(fields);
  }

  public Fields(org.apache.heron.api.tuple.Fields delegate) {
    this.delegate = delegate;
  }

  public Fields(List fields) {
    delegate = new org.apache.heron.api.tuple.Fields(fields);
  }

  public List select(Fields selector, List tuple) {
    return delegate.select(selector.getDelegate(), tuple);
  }

  public List toList() {
    return delegate.toList();
  }

  public int size() {
    return delegate.size();
  }

  public String get(int index) {
    return delegate.get(index);
  }

  public Iterator iterator() {
    return delegate.iterator();
  }

  /**
   * Returns the position of the specified field.
   */
  public int fieldIndex(String field) {
    return delegate.fieldIndex(field);
  }

  /**
   * Returns true if this contains the specified name of the field.
   */
  public boolean contains(String field) {
    return delegate.contains(field);
  }

  public String toString() {
    return delegate.toString();
  }

  public org.apache.heron.api.tuple.Fields getDelegate() {
    return delegate;
  }
}