com.threewks.thundr.bigmetrics.service.EventMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of thundr-bigmetrics Show documentation
Show all versions of thundr-bigmetrics Show documentation
A thundr module for supporting metrics in big query
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.service;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Map;
import com.atomicleopard.expressive.ETransformer;
import com.atomicleopard.expressive.Expressive;
import com.atomicleopard.expressive.transform.CollectionTransformer;
import com.threewks.thundr.bigmetrics.bigquery.BigQueryType;
import com.threewks.thundr.bigmetrics.field.FieldProcessor;
public class EventMetadata {
private Class> type;
private String eventName;
private String table;
private Map columns;
private Map> processors;
public EventMetadata(Class> type, String eventName, String table, Map columns, Map> processors) {
super();
this.type = type;
this.eventName = eventName;
this.table = table;
this.columns = columns;
this.processors = processors;
}
public Class> getType() {
return type;
}
public String getEventName() {
return eventName;
}
public String getTable() {
return table;
}
public Map getColumns() {
return columns;
}
public Map> getFieldProcessors() {
return processors;
}
@Override
public String toString() {
return String.format("Event '%s' - table '%s'", type.getSimpleName(), table);
}
public static class Transformers {
public static final CollectionTransformer ToTableNames = Expressive.Transformers.transformAllUsing(Expressive.Transformers. toProperty("table", EventMetadata.class));
public static final CollectionTransformer ToEventNames = Expressive.Transformers.transformAllUsing(Expressive.Transformers. toProperty("eventName", EventMetadata.class));
public static final ETransformer, Map> ToTableNameLookup = Expressive.Transformers.toKeyBeanLookup("table", EventMetadata.class);
public static final ETransformer, Map> ToEventNameLookup = Expressive.Transformers.toKeyBeanLookup("eventName", EventMetadata.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy