use of org.dbflute.logic.sql2entity.analyzer.DfSql2EntityMarkAnalyzer in project dbflute-core by dbflute.
the class DfSql2EntityMarkAnalyzerTest method test_getDescription_basic.
// ===================================================================================
// Title/Description
// =================
public void test_getDescription_basic() {
// ## Arrange ##
DfSql2EntityMarkAnalyzer analyzer = new DfSql2EntityMarkAnalyzer();
String descriptionMark = DfSql2EntityMarkAnalyzer.DESCRIPTION_MARK;
String sql = "/*" + descriptionMark + "\n foo \n*/ select from";
// ## Act ##
String description = analyzer.getDescription(sql);
// ## Assert ##
assertEquals(" foo", description);
}
use of org.dbflute.logic.sql2entity.analyzer.DfSql2EntityMarkAnalyzer in project dbflute-core by dbflute.
the class DfSql2EntityMarkAnalyzerTest method test_getSelectColumnCommentMap_basic.
// ===================================================================================
// SelectColumnComment
// ===================
public void test_getSelectColumnCommentMap_basic() {
// ## Arrange ##
DfSql2EntityMarkAnalyzer analyzer = new DfSql2EntityMarkAnalyzer();
StringBuilder sb = new StringBuilder();
sb.append("select FOO as FOO_ID -- // Comment1");
sb.append(ln()).append(" , foo.BAR_NAME -- // Comment2");
sb.append(ln()).append(" , BAZ_DATE -- // Comment3");
// ## Act ##
Map<String, String> commentMap = analyzer.getSelectColumnCommentMap(sb.toString());
// ## Assert ##
log(commentMap);
assertEquals("Comment1", commentMap.get("FOO_ID"));
assertEquals("Comment2", commentMap.get("BAR_NAME"));
assertEquals("Comment3", commentMap.get("BAZ_DATE"));
}
use of org.dbflute.logic.sql2entity.analyzer.DfSql2EntityMarkAnalyzer in project dbflute-core by dbflute.
the class DfMailFluteTableLoader method processSpecifiedDetect.
protected void processSpecifiedDetect(String fileText, Map<String, String> propertyNameTypeMap, Map<String, String> propertyNameOptionMap, Set<String> propertyNameSet) {
final List<DfSql2EntityMark> propertyTypeList = new DfSql2EntityMarkAnalyzer().getParameterBeanPropertyTypeList(fileText);
for (DfSql2EntityMark mark : propertyTypeList) {
final String content = mark.getContent();
final String propertyType = Srl.substringFirstFront(content, " ").trim();
final String propertyName = Srl.substringFirstRear(content, " ").trim();
propertyNameTypeMap.put(propertyName, resolvePackageName(propertyType));
propertyNameSet.add(propertyName);
}
}
use of org.dbflute.logic.sql2entity.analyzer.DfSql2EntityMarkAnalyzer in project dbflute-core by dbflute.
the class DfOutsideSqlChecker method checkRequiredDescription.
// -----------------------------------------------------
// Required Description
// --------------------
protected void checkRequiredDescription(String fileName, String sql) {
if (!_requiredDescriptionCheck) {
return;
}
final DfSql2EntityMarkAnalyzer analyzer = new DfSql2EntityMarkAnalyzer();
final String desc = analyzer.getDescription(sql);
if (isInvalidDescription(desc)) {
throwRequiredOutsideSqlDescriptionNotFoundException(desc, fileName, sql);
}
if (!_suppressDescriptionUniqueCheck) {
final String otherFileName = _outsideSqlDescriptionSet.get(desc);
if (otherFileName != null) {
throwRequiredOutsideSqlDescriptionSameWithOtherSqlException(desc, otherFileName, fileName, sql);
}
_outsideSqlDescriptionSet.put(desc, fileName);
}
}
Aggregations