com.podio.item.map.FieldMap Maven / Gradle / Ivy
package com.podio.item.map;
import java.beans.PropertyDescriptor;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.podio.app.ApplicationField;
import com.podio.item.FieldValuesUpdate;
import com.podio.item.FieldValuesView;
import com.podio.item.map.converter.FieldConverter;
import com.podio.item.map.converter.FieldConverterRegistry;
public class FieldMap {
private final String externalId;
private final PropertyDescriptor property;
private final boolean single;
private final FieldConverter converter;
private FieldMap(String externalId, PropertyDescriptor property,
boolean single, FieldConverter converter) {
super();
this.externalId = externalId;
this.property = property;
this.single = single;
this.converter = converter;
}
public FieldValuesUpdate fromModel(Object model) {
Object value;
try {
value = property.getReadMethod().invoke(model);
} catch (Exception e) {
throw new RuntimeException("Unable to get model value", e);
}
List