public static List<EffigyFieldPair> pair(HollowEffigy from, HollowEffigy to, Map<String, PrimaryKey> matchHints) {
if(from == null || to == null)
return new HollowEffigyNullPartnerPairer(from, to).pair();
if(from.getDataAccess() == null)
return new HollowEffigyObjectPairer(from, to).pair();
HollowSchema schema = from.getDataAccess().getSchema();
switch(schema.getSchemaType()) {
case OBJECT:
return new HollowEffigyObjectPairer(from, to).pair();
case MAP:
String keyType = ((HollowMapSchema)schema).getKeyType();
return new HollowEffigyMapPairer(from, to, matchHints.get(keyType)).pair();
case LIST:
case SET:
String elementType = ((HollowCollectionSchema)schema).getElementType();
return new HollowEffigyCollectionPairer(from, to, matchHints.get(elementType)).pair();
}
throw new IllegalArgumentException("I don't know how to pair fields for type " + schema.getName() + "(" + schema.getSchemaType() + ")");
}
}