// Path: spring-influxdb-orm/src/main/java/com/vgerbot/orm/influxdb/InfluxDBException.java
// public class InfluxDBException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -4410268653794610252L;
// 
// 	public InfluxDBException() {
// 		super();
// 	}
// 
// 	public InfluxDBException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public InfluxDBException(String message) {
// 		super(message);
// 	}
// 
// 	public InfluxDBException(Throwable cause) {
// 		super(cause);
// 	}
// }


import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.ReflectionUtils;
import com.vgerbot.orm.influxdb.InfluxDBException;
import com.vgerbot.orm.influxdb.annotations.FieldColumn;
import com.vgerbot.orm.influxdb.annotations.InfluxDBMeasurement;
import com.vgerbot.orm.influxdb.annotations.TagColumn;
package com.vgerbot.orm.influxdb.metadata;




public class MeasurementClassMetadata {

	private final String measurementName;
	private final String retentionPolicy;

	private final Class<? extends Serializable> measurementClass;
	private final PropertyDescriptor shardingFieldDescriptor;
	private final PropertyDescriptor timeFieldDescriptor;
	/**
	 * map<数据库名称, java字段名称>
	 */
	private final Map<String, String> tagColumnJavaFieldNameMap;
	/**
	 * map<数据库字段名称, java字段名称>
	 */
	private final Map<String, String> fieldColumnJavaFieldNameMap;
	/**
	 * map<数据库字段名称, PropertyDescriptor>
	 */
	private final Map<String, PropertyDescriptor> tagColumnDescriptors;
	/**
	 * map<数据库字段名称, PropertyDescriptor>
	 */
	private final Map<String, PropertyDescriptor> fieldColumnDescriptors;

	private boolean isJavaUtilDateTimeField;
	private boolean isNumberTimeField;
	private boolean isStringTimeField;
	private String[] datetimePatterns;
	private final int _hashcode;

	public MeasurementClassMetadata(Class<? extends Serializable> measurementClass, String defaultRetentionPolicy) {
		this.measurementClass = measurementClass;
		tagColumnJavaFieldNameMap = new HashMap<>();
		fieldColumnJavaFieldNameMap = new HashMap<>();
		tagColumnDescriptors = new HashMap<>();
		fieldColumnDescriptors = new HashMap<>();

		Map<String, PropertyDescriptor> descriptorsMap = descriptorsMap(measurementClass);

		timeFieldDescriptor = descriptorsMap.get("time");
		assertTimeFieldDescriptorNotNull();

		Class<?> timeFieldType = timeFieldDescriptor.getPropertyType();

		isJavaUtilDateTimeField = Date.class.isAssignableFrom(timeFieldType);
		isNumberTimeField = Number.class.isAssignableFrom(timeFieldType);
		isStringTimeField = CharSequence.class.isAssignableFrom(timeFieldType);

		if (!isJavaUtilDateTimeField && !isNumberTimeField && !isStringTimeField) {
// Path: spring-influxdb-orm/src/main/java/com/vgerbot/orm/influxdb/InfluxDBException.java
// public class InfluxDBException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -4410268653794610252L;
// 
// 	public InfluxDBException() {
// 		super();
// 	}
// 
// 	public InfluxDBException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public InfluxDBException(String message) {
// 		super(message);
// 	}
// 
// 	public InfluxDBException(Throwable cause) {
// 		super(cause);
// 	}
// }


// Path: spring-influxdb-orm/src/main/java/com/vgerbot/orm/influxdb/metadata/MeasurementClassMetadata.java
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.ReflectionUtils;
import com.vgerbot.orm.influxdb.InfluxDBException;
import com.vgerbot.orm.influxdb.annotations.FieldColumn;
import com.vgerbot.orm.influxdb.annotations.InfluxDBMeasurement;
import com.vgerbot.orm.influxdb.annotations.TagColumn;

package com.vgerbot.orm.influxdb.metadata;




public class MeasurementClassMetadata {

	private final String measurementName;
	private final String retentionPolicy;

	private final Class<? extends Serializable> measurementClass;
	private final PropertyDescriptor shardingFieldDescriptor;
	private final PropertyDescriptor timeFieldDescriptor;
	/**
	 * map<数据库名称, java字段名称>
	 */
	private final Map<String, String> tagColumnJavaFieldNameMap;
	/**
	 * map<数据库字段名称, java字段名称>
	 */
	private final Map<String, String> fieldColumnJavaFieldNameMap;
	/**
	 * map<数据库字段名称, PropertyDescriptor>
	 */
	private final Map<String, PropertyDescriptor> tagColumnDescriptors;
	/**
	 * map<数据库字段名称, PropertyDescriptor>
	 */
	private final Map<String, PropertyDescriptor> fieldColumnDescriptors;

	private boolean isJavaUtilDateTimeField;
	private boolean isNumberTimeField;
	private boolean isStringTimeField;
	private String[] datetimePatterns;
	private final int _hashcode;

	public MeasurementClassMetadata(Class<? extends Serializable> measurementClass, String defaultRetentionPolicy) {
		this.measurementClass = measurementClass;
		tagColumnJavaFieldNameMap = new HashMap<>();
		fieldColumnJavaFieldNameMap = new HashMap<>();
		tagColumnDescriptors = new HashMap<>();
		fieldColumnDescriptors = new HashMap<>();

		Map<String, PropertyDescriptor> descriptorsMap = descriptorsMap(measurementClass);

		timeFieldDescriptor = descriptorsMap.get("time");
		assertTimeFieldDescriptorNotNull();

		Class<?> timeFieldType = timeFieldDescriptor.getPropertyType();

		isJavaUtilDateTimeField = Date.class.isAssignableFrom(timeFieldType);
		isNumberTimeField = Number.class.isAssignableFrom(timeFieldType);
		isStringTimeField = CharSequence.class.isAssignableFrom(timeFieldType);

		if (!isJavaUtilDateTimeField && !isNumberTimeField && !isStringTimeField) {
			throw new InfluxDBException("Unsupported time field type: " + timeFieldType);