/*
 * Licensed 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 com.addthis.hydra.data.query.op.merge;

import com.addthis.bundle.core.Bundle;
import com.addthis.bundle.core.BundleField;
import com.addthis.hydra.data.query.op.MergedRow;

public interface MergedValue {

    public void merge(Bundle nextBundle, MergedRow mergedRow);

    public void emit(MergedRow mergedRow);

    public boolean isKey();

    public BundleField getFrom();

    public BundleField getTo();

    public void setFrom(BundleField from);

    public void setTo(BundleField to);

}
@@ -738,175 +738,1829 @@
 w;%0A%0A
-public interface MergedValue %7B%0A%0A    public void merge(Bundle nextBundle, MergedRow mergedRow);%0A%0A    public void emit(MergedRow mergedRow);%0A%0A    public boolean isKey();
+/**%0A * Both a Merge Operation (basically a function with a small amount of state),%0A * and a bundle format field bridge between two formats.%0A */%0Apublic interface MergedValue %7B%0A%0A    /**%0A     * Access a value from nextBundle and merges it with a value in mergedRow.%0A     * Currently it is at most one field from each bundle, but more could be%0A     * interacted with if the implementation is careful.%0A     *%0A     * Note that this does _not_ merge the entire bundle like a similar method%0A     * on MergedRow does. The method uses this signature in order to encapsulate%0A     * bundle field lookup logic and provide a little more flexibility to the%0A     * internals if needed (the latter being the reason MergedRow is used explicitly%0A     * in place of Bundle).%0A     */%0A    public void merge(Bundle nextBundle, MergedRow mergedRow);%0A%0A    /**%0A     * Signals the end of additional bundles/values to merge. May set a value%0A     * in mergedRow based on accumulated data.%0A     */%0A    public void emit(MergedRow mergedRow);%0A%0A    /**%0A     * This field/value should be used when controlling which rows to merge. Currently%0A     * only used by KeyValue, which makes it basically 'instanceof KeyValue', but putting%0A     * this here is a little more readable, provides some future options, and better%0A     * protects against changing api / structure in the future (where eg. KeyValue may%0A     * no longer exist as a class).%0A     */%0A    public boolean isKey();%0A%0A    /**%0A     * Getters and setters for the object fields that are used by merge/emit to access%0A     * MergedRows and Bundles. They provide the bridging logic, and could be spun into%0A     * their own interface, but MergedValue would basically have to extend it because%0A     * it is a little disingenuous to suggest it should can or should easily be used%0A     * without it.%0A     */
 %0A%0A  

add some javadoc to merged value