Search in sources :

Example 16 with DfLanguageGrammar

use of org.dbflute.logic.generate.language.grammar.DfLanguageGrammar in project dbflute-core by dbflute.

the class DfPmbMetaData method buildPropertyOptionClassificationElementValueExp.

protected String buildPropertyOptionClassificationElementValueExp(String propertyName, String classificationName, String element) {
    final String valueType;
    if (isPropertyTypeList(propertyName)) {
        valueType = getPropertyTypeOfListElement(propertyName);
    } else {
        valueType = getPropertyType(propertyName);
    }
    final String cdefBase = getBasicProperties().getCDefPureName() + "." + classificationName + "." + element;
    final DfLanguageGrammar grammar = getLanguageGrammar();
    final boolean toNumber = isPropertyJavaNativeNumberObjectIncludingListElement(propertyName);
    final boolean toBoolean = isPropertyJavaNativeBooleanObjectIncludingListElement(propertyName);
    return grammar.buildCDefElementValue(cdefBase, propertyName, valueType, toNumber, toBoolean);
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)

Example 17 with DfLanguageGrammar

use of org.dbflute.logic.generate.language.grammar.DfLanguageGrammar in project dbflute-core by dbflute.

the class DfPmbMetaData method isPropertyTypeList.

public boolean isPropertyTypeList(String propertyName) {
    final String propertyType = getPropertyType(propertyName);
    final DfLanguageGrammar grammar = getLanguageGrammar();
    return grammar.hasGenericClassElement("List", propertyType);
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)

Example 18 with DfLanguageGrammar

use of org.dbflute.logic.generate.language.grammar.DfLanguageGrammar in project dbflute-core by dbflute.

the class DfPmbMetaData method getProcedureParameterOracleArrayElementJavaNativeTypeLiteral.

public String getProcedureParameterOracleArrayElementJavaNativeTypeLiteral(String propertyName) {
    final String javaNative = getProcedureParameterOracleArrayElementJavaNative(propertyName);
    final DfLanguageGrammar grammar = getLanguageGrammar();
    return grammar.buildClassTypeLiteral(Srl.substringFirstFrontIgnoreCase(javaNative, "<"));
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)

Example 19 with DfLanguageGrammar

use of org.dbflute.logic.generate.language.grammar.DfLanguageGrammar in project dbflute-core by dbflute.

the class DfPmbMetaData method getProcedureParameterOracleStructEntityTypeTypeLiteral.

public String getProcedureParameterOracleStructEntityTypeTypeLiteral(String propertyName) {
    final String entityType = getProcedureParameterOracleStructEntityType(propertyName);
    final DfLanguageGrammar grammarInfo = getLanguageGrammar();
    return grammarInfo.buildClassTypeLiteral(Srl.substringFirstFrontIgnoreCase(entityType, "<"));
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)

Example 20 with DfLanguageGrammar

use of org.dbflute.logic.generate.language.grammar.DfLanguageGrammar in project dbflute-core by dbflute.

the class DfParameterAutoDetectForNode method analyzeForNodeElementType.

protected DfForNodeDetectedPropertyInfo analyzeForNodeElementType(Node node, String propertyName) {
    if (isPmCommentNestedProperty(propertyName) || isPmCommentMethodCall(propertyName)) {
        return null;
    }
    final DfLanguageGrammar grammar = getLanguageGrammar();
    DfForNodeDetectedPropertyInfo detected = null;
    for (int i = 0; i < node.getChildSize(); i++) {
        final Node childNode = node.getChild(i);
        if (childNode instanceof BindVariableNode) {
            final BindVariableNode bindNode = (BindVariableNode) childNode;
            final String expression = bindNode.getExpression();
            if (!isPmCommentEqualsCurrent(expression)) {
                continue;
            }
            if (isPmCommentNestedProperty(expression) || isPmCommentMethodCall(expression)) {
                continue;
            }
            // /*#current*/ here
            final String testValue = bindNode.getTestValue();
            if (testValue == null) {
                continue;
            }
            final String propertyType = derivePropertyTypeFromTestValue(testValue);
            final String propertyOption = derivePropertyOptionFromTestValue(testValue);
            if (Srl.is_NotNull_and_NotTrimmedEmpty(propertyType)) {
                detected = new DfForNodeDetectedPropertyInfo();
                final String generic = grammar.buildGenericOneClassHint(propertyType);
                detected.setPropertyType("List" + generic);
                detected.setPropertyOption(propertyOption);
            }
        } else if (childNode instanceof ForNode) {
            final ForNode nestedNode = (ForNode) childNode;
            final String expression = nestedNode.getExpression();
            if (!isPmCommentStartsWithCurrent(expression)) {
                continue;
            }
            // /*FOR #current.xxx*/ here
            final String nestedForPropName = substringPmCommentCurrentRear(expression);
            // recursive call
            detected = analyzeForNodeElementType(nestedNode, nestedForPropName);
            if (detected != null) {
                final String generic = grammar.buildGenericOneClassHint(detected.getPropertyType());
                detected.setPropertyType("List" + generic);
            }
        } else if (childNode instanceof ScopeNode) {
            // IF, Begin, First, ...
            // recursive call
            detected = analyzeForNodeElementType(childNode, propertyName);
        }
        if (detected != null) {
            break;
        }
    }
    if (detected == null) {
        return null;
    }
    return detected;
}
Also used : ForNode(org.dbflute.twowaysql.node.ForNode) BindVariableNode(org.dbflute.twowaysql.node.BindVariableNode) ScopeNode(org.dbflute.twowaysql.node.ScopeNode) Node(org.dbflute.twowaysql.node.Node) ForNode(org.dbflute.twowaysql.node.ForNode) DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar) ScopeNode(org.dbflute.twowaysql.node.ScopeNode) BindVariableNode(org.dbflute.twowaysql.node.BindVariableNode)

Aggregations

DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)24 DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)3 DfLanguageImplStyle (org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)2 DfBasicProperties (org.dbflute.properties.DfBasicProperties)2 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 OutputStreamWriter (java.io.OutputStreamWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Time (java.sql.Time)1 Timestamp (java.sql.Timestamp)1 List (java.util.List)1 Map (java.util.Map)1 Column (org.apache.torque.engine.database.model.Column)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1 DfArrangeQueryTable (org.dbflute.logic.doc.arrqy.DfArrangeQueryTable)1