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

org.sfm.map.impl.CalculateMaxIndex Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.map.impl;

import org.sfm.map.ColumnDefinition;
import org.sfm.map.FieldKey;
import org.sfm.reflect.meta.ArrayElementPropertyMeta;
import org.sfm.reflect.meta.PropertyMeta;
import org.sfm.reflect.meta.SubPropertyMeta;
import org.sfm.utils.ForEachCallBack;

public final class CalculateMaxIndex, D extends ColumnDefinition> implements
		ForEachCallBack> {
	public int maxIndex = -1;

	@SuppressWarnings("unchecked")
	@Override
	public void handle(PropertyMapping e) {
		int currentIndex = -1;
		if (e != null) {
			PropertyMeta propMeta = e.getPropertyMeta();
			if (propMeta.isSubProperty()) {
				propMeta = ((SubPropertyMeta)propMeta).getOwnerProperty();
			}
			
			if (propMeta instanceof ArrayElementPropertyMeta) {
				currentIndex = ((ArrayElementPropertyMeta) propMeta).getIndex();
			}
		}
		maxIndex = Math.max(currentIndex, maxIndex);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy