use of org.dbflute.jdbc.ClassificationCodeType in project dbflute-core by dbflute.
the class ManualOrderOption method handleClassificationOrderValue.
// -----------------------------------------------------
// Classification
// --------------
protected Object handleClassificationOrderValue(Classification cls) {
final Object orderValue;
final String plainCode = cls.code();
final ClassificationCodeType codeType = cls.meta().codeType();
if (ClassificationCodeType.Number.equals(codeType)) {
if ("true".equalsIgnoreCase(plainCode) || "false".equalsIgnoreCase(plainCode)) {
// true or false of Number, e.g. MySQL's Boolean
orderValue = toClassificationBooleanValue(plainCode);
} else {
orderValue = toClassificationIntegerValue(plainCode);
}
} else if (ClassificationCodeType.Boolean.equals(codeType)) {
orderValue = toClassificationBooleanValue(plainCode);
} else {
orderValue = plainCode;
}
return orderValue;
}
use of org.dbflute.jdbc.ClassificationCodeType in project dbflute-core by dbflute.
the class ManualOrderOption method resolveBoundValue.
// -----------------------------------------------------
// Resolve Bound
// -------------
protected Object resolveBoundValue(HpManualOrderThemeListHandler handler, Object plainValue, boolean suppressBinding) {
if (plainValue == null) {
return null;
}
if (plainValue instanceof SpecifiedColumn) {
return resolveDreamCruiseExp(plainValue);
}
ClassificationCodeType codeType = null;
if (plainValue instanceof Classification) {
final Classification cls = (Classification) plainValue;
plainValue = handleClassificationOrderValue(cls);
codeType = cls.meta().codeType();
}
final Object boundExp;
if (suppressBinding) {
if (plainValue instanceof String) {
if (canBeLiteralClassificationCodeType(codeType)) {
boundExp = plainValue;
} else {
String notice = "The binding of string value is unsupported on the DBMS.";
throwUnsupportedTypeSpecifiedException(notice, plainValue);
// unreachable
boundExp = null;
}
} else if (plainValue instanceof Number) {
boundExp = buildLiteralNumberExpression(plainValue);
} else if (isAnyLocalDate(plainValue) || plainValue instanceof Date) {
// #date_parade
boundExp = buildLiteralDateExpression(plainValue);
} else {
String notice = "The binding of the type is unsupported on the DBMS.";
throwUnsupportedTypeSpecifiedException(notice, plainValue);
// unreachable
boundExp = null;
}
} else {
boundExp = handler.register(THEME_KEY, plainValue);
}
return boundExp;
}
Aggregations