public static List<ForcedType> defaultForcedTypes() { return Lists.newLinkedList(Arrays.asList(new ForcedType[] { new ForcedType() .withName("BOOLEAN") .withTypes("tinyint") })); } }
if (type.getExpressions() != null) { type.setExpression(type.getExpressions()); type.setExpressions(null); log.warn("DEPRECATED", "The <expressions/> element in <forcedType/> is deprecated. Use <expression/> instead: " + type); if (StringUtils.isBlank(type.getName())) { if (StringUtils.isBlank(type.getUserType())) { log.warn("Bad configuration for <forcedType/>. Either <name/> or <userType/> is required: " + type); if (StringUtils.isBlank(type.getBinding()) && StringUtils.isBlank(type.getConverter()) && !Boolean.TRUE.equals(type.isEnumConverter())) { log.warn("Bad configuration for <forcedType/>. Either <binding/> or <converter/> or <enumConverter/> is required: " + type); if (!StringUtils.isBlank(type.getUserType())) { log.warn("Bad configuration for <forcedType/>. <userType/> is not allowed when <name/> is provided: " + type); type.setUserType(null); if (!StringUtils.isBlank(type.getBinding())) { log.warn("Bad configuration for <forcedType/>. <binding/> is not allowed when <name/> is provided: " + type); type.setBinding(null); if (!StringUtils.isBlank(type.getConverter())) { log.warn("Bad configuration for <forcedType/>. <converter/> is not allowed when <name/> is provided: " + type); type.setConverter(null); if (Boolean.TRUE.equals(type.isEnumConverter())) { log.warn("Bad configuration for <forcedType/>. <enumConverter/> is not allowed when <name/> is provided: " + type); type.setEnumConverter(null);
@SuppressWarnings("deprecation") public static final CustomType customType(Database db, ForcedType forcedType) { String name = forcedType.getName(); // [#4598] Legacy use-case where a <forcedType/> referes to a <customType/> // element by name. if (StringUtils.isBlank(forcedType.getUserType())) { if (name != null) for (CustomType type : db.getConfiguredCustomTypes()) if (name.equals(type.getName())) return type; } // [#4598] New default use-case where <forcedType/> embeds <customType/> // information for convenience. else { return new CustomType() .withBinding(forcedType.getBinding()) .withEnumConverter(forcedType.isEnumConverter()) .withConverter(forcedType.getConverter()) .withName(name) .withType(forcedType.getUserType()); } return null; } }
String expression = StringUtils.defaultIfNull(forcedType.getExpressions(), forcedType.getExpression()); String types = forcedType.getTypes(); Nullability nullability = forcedType.getNullability();
/** * Create an instance of {@link ForcedType } * */ public ForcedType createForcedType() { return new ForcedType(); }