Search in sources :

Example 1 with DfLanguagePropertyPackageResolver

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver in project dbflute-core by dbflute.

the class ForeignKey method filterDynamicFixedConditionParameterType.

protected String filterDynamicFixedConditionParameterType(String parameterType) {
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
    return resolver.resolvePackageName(parameterType);
}
Also used : DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguagePropertyPackageResolver(org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)

Example 2 with DfLanguagePropertyPackageResolver

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver in project dbflute-core by dbflute.

the class DfParameterBeanResolver method resolvePackageNameExceptUtil.

protected String resolvePackageNameExceptUtil(String typeName) {
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
    return resolver.resolvePackageNameExceptUtil(typeName);
}
Also used : DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguagePropertyPackageResolver(org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)

Example 3 with DfLanguagePropertyPackageResolver

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver in project dbflute-core by dbflute.

the class DfPmbMetaData method adjustPropertyMetaFinally.

// ===================================================================================
//          Adjustment
// ==========
public void adjustPropertyMetaFinally(AppData schemaData) {
    // basically this adjusts property types for auto-detected properties
    // it should be called after initialization
    // (not called by procedure)
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguagePropertyPackageResolver packageResolver = lang.getLanguagePropertyPackageResolver();
    final Set<String> autoDetectedPropertyNameSet = getAutoDetectedPropertyNameSet();
    if (autoDetectedPropertyNameSet == null || autoDetectedPropertyNameSet.isEmpty()) {
        return;
    }
    final Map<String, String> propertyNameTypeMap = getPropertyNameTypeMap();
    for (String propertyName : autoDetectedPropertyNameSet) {
        // loop for auto-detected properties
        final String beforeType = propertyNameTypeMap.get(propertyName);
        String afterType = null;
        if (isPropertyTypeList(propertyName) && isPropertyOptionClassification(propertyName, schemaData)) {
            if (isPropertyOptionClassificationFixedElement(propertyName)) {
            // :cls(Maihama.Sea) or :cls(Maihama.Sea, Land)
            // e.g. /*pmb.maihamaList:cls(Maihama.Sea)*/ or /*pmb.maihamaList:cls(Maihama.Sea, Land)*/
            // no adjustment because fixed element list needs List<String> as framework-internal property
            } else {
                // list property by public setter, wants to be e.g. List<CDef.Maihama>
                final String classificationName = getPropertyOptionClassificationName(propertyName, schemaData);
                final String plainType = "$$CDef$$." + classificationName;
                // ParameterBean has the "import" clause of language-embedded utility
                afterType = packageResolver.resolvePackageNameExceptUtil(plainType);
            }
        } else if (!beforeType.contains("CDef")) {
            final Column refColumn = getPropertyOptionReferenceColumn(propertyName, schemaData);
            if (refColumn != null) {
                // not CDef and reference
                afterType = refColumn.getJavaNative();
                final String utilPrefix = "java.util.";
                if (Srl.startsWith(afterType, utilPrefix) && Srl.count(afterType, ".") == 2) {
                    // ParameterBean has the "import" clause of language-embedded utility
                    afterType = Srl.substringFirstRear(afterType, utilPrefix);
                }
            }
        }
        if (afterType != null) {
            final String finalType;
            if (isPropertyTypeList(propertyName)) {
                final DfLanguageGrammar grammar = getLanguageGrammar();
                final String beginMark = grammar.getGenericBeginMark();
                final String endMark = grammar.getGenericEndMark();
                final String prefix = Srl.substringFirstFront(beforeType, "List" + beginMark);
                final String suffix = Srl.substringLastRear(beforeType, endMark);
                finalType = prefix + "List" + beginMark + afterType + endMark + suffix;
            } else {
                finalType = afterType;
            }
            // override
            propertyNameTypeMap.put(propertyName, finalType);
        }
    }
}
Also used : Column(org.apache.torque.engine.database.model.Column) DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguagePropertyPackageResolver(org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)

Example 4 with DfLanguagePropertyPackageResolver

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver in project dbflute-core by dbflute.

the class DfFixedConditionDynamicAnalyzer method filterDynamicFixedConditionParameterType.

protected String filterDynamicFixedConditionParameterType(String parameterType) {
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
    return resolver.resolvePackageName(parameterType);
}
Also used : DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguagePropertyPackageResolver(org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)

Example 5 with DfLanguagePropertyPackageResolver

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver in project dbflute-core by dbflute.

the class DfMailFluteTableLoader method resolvePackageName.

protected String resolvePackageName(String typeName) {
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
    return resolver.resolvePackageName(typeName);
}
Also used : DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguagePropertyPackageResolver(org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)

Aggregations

DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)8 DfLanguagePropertyPackageResolver (org.dbflute.logic.generate.language.pkgstyle.DfLanguagePropertyPackageResolver)8 Column (org.apache.torque.engine.database.model.Column)1 DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)1