// check for named handler first
ValueHandler handler = namedHandler(field);
if (handler != null) {
if (installHandlers)
field.setHandler(handler);
return new HandlerFieldStrategy();
}
if (field.isSerialized()) {
if (_dict.maxEmbeddedBlobSize != -1)
return new MaxEmbeddedBlobFieldStrategy();
} else {
// check for mapped strategy
Object strat = mappedStrategy(field, field.getType(), adapting);
if (strat instanceof FieldStrategy)
return (FieldStrategy) strat;
if (strat != null) {
if (installHandlers)
field.setHandler((ValueHandler) strat);
return new HandlerFieldStrategy();
}
}
// check for known field strategies
if (!field.isSerialized() && (field.getType() == byte[].class
|| field.getType() == Byte[].class)) {
if (_dict.maxEmbeddedBlobSize != -1)
return new MaxEmbeddedByteArrayFieldStrategy();
} else if (!field.isSerialized()
&& (field.getType() == char[].class
|| field.getType() == Character[].class)) {
if (_dict.maxEmbeddedClobSize != -1 && isClob(field, false))
return new MaxEmbeddedCharArrayFieldStrategy();
} else if (!field.isSerialized()) {
FieldStrategy strat = defaultTypeStrategy(field, installHandlers,
adapting);
if (strat != null)
return strat;
}
// check for default handler
handler = defaultHandler(field, adapting);
if (handler != null) {
if (installHandlers)
field.setHandler(handler);
return new HandlerFieldStrategy();
}
// default to blob
if (installHandlers) {
if (getLog().isWarnEnabled())
getLog().warn(_loc.get("no-field-strategy", field));
field.setSerialized(true);
}
if (_dict.maxEmbeddedBlobSize == -1) {
if (installHandlers)
field.setHandler(BlobValueHandler.getInstance());
return new HandlerFieldStrategy();
}
return new MaxEmbeddedBlobFieldStrategy();
}