public FieldMapping()

in src/main/java/com/univocity/parsers/annotations/helpers/FieldMapping.java [55:89]


	public FieldMapping(Class<?> beanClass, AnnotatedElement target, PropertyWrapper property, HeaderTransformer transformer, String[] headers) {
		this.beanClass = beanClass;
		this.target = target;
		if (target instanceof Field) {
			this.readMethod = property != null ? property.getReadMethod() : null;
			this.writeMethod = property != null ? property.getWriteMethod() : null;
		} else {
			Method method = (Method) target;
			this.readMethod = method.getReturnType() != Void.class ? method : null;
			this.writeMethod = method.getParameterTypes().length != 0 ? method : null;
		}

		Class typeToSet;

		if (target != null) {
			typeToSet = getType(target);
			parentClass = getDeclaringClass(target);
		} else if (writeMethod != null && writeMethod.getParameterTypes().length == 1) {
			typeToSet = writeMethod.getParameterTypes()[0];
			parentClass = writeMethod.getDeclaringClass();
		} else {
			typeToSet = Object.class;
			if (readMethod != null) {
				parentClass = readMethod.getDeclaringClass();
			} else {
				parentClass = beanClass;
			}
		}

		primitive = typeToSet.isPrimitive();
		defaultPrimitiveValue = getDefaultPrimitiveValue(typeToSet);
		primitiveNumber = (defaultPrimitiveValue instanceof Number);
		determineFieldMapping(transformer, headers);
		fieldType = typeToSet;
	}