public Representation<?> createRepresentation(Class<?> clazz) { /* If we have a specific representation for this type, use it. */ if (reprMap_.containsKey(clazz)) { return reprMap_.get(clazz); } /* Arrays need treating specially. */ else if (clazz.isArray()) { Class<?> scalarClass = getScalarClass(clazz); if (reprMap_.containsKey(scalarClass)) { Representation<?> scalarRepr = reprMap_.get(scalarClass); /* If the scalar type is a structured object * (either appears in the map of known types with * isColumn=false, or implicitly structured by being absent * from that map), * there's not much we can do with it, since you * can't map that structure to a sequence of columns * (you don't know how many there would be). * So we have to discard it. */ if (scalarRepr == null || !scalarRepr.isColumn()) { return null; } /* If the scalar type is a column type, assume that it's * OK for an array (or array of arrays, or ...) to be * a column too. Note however that this code is not * quite right at the moment; it will work for identity * representations, but ones that convert input objects * to a different representation (e.g. toString) will * go wrong here. */ else { return createSimpleColumnRepresentation(clazz); } } else { return null; } } /* Non-array types with no special instructions will be treated * as structured objects. */ else { return createIdentityRepresentation(clazz, false); } }