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

com.threewks.thundr.bigmetrics.field.FieldProcessor Maven / Gradle / Ivy

The newest version!
/*
 * This file is a component of thundr, a software library from 3wks.
 * Read more: http://www.3wks.com.au/thundr
 * Copyright (C) 2014 3wks, 
 *
 * 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.threewks.thundr.bigmetrics.field;

import java.util.Map;

import com.threewks.thundr.bigmetrics.As;
import com.threewks.thundr.bigmetrics.bigquery.BigQueryType;

/**
 * A {@link FieldProcessor} defines the columns that a single field will be
 * converted to when pushed to BQ.
 * 
 * A field may be converted to many to help denormalise some of the content to make
 * certain types of querying easier after the fact.
 *
 * All {@link FieldProcessor} implementations must have a no-arg constructor.
 * These are invoked based on the class defined in {@link As#processor()}
 * 
 * 
 * @param 
 */
public interface FieldProcessor {
	/**
	 * Given a field name and data type, returns the names of the fields and the types
	 * that would result at processing time. That is, effectively defines many named columns
	 * which need to exist in BQ.
	 * 
	 * @param name field name
	 * @param type field type
	 * @return the names of the fields and their types
	 */
	public Map fields(String name, BigQueryType type);

	/**
	 * For the given value, process the value so that all the columns have an appropriate value.
	 * 
	 * @param name field name
	 * @param type field type
	 * @param value the value
	 * @return the columns and their values
	 */
	public Map process(String name, BigQueryType type, T value);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy