Search in sources :

Example 1 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfColumnListToStringBuilder method getColumnArgsSetupPropertyString.

public static String getColumnArgsSetupPropertyString(String beanName, List<Column> columnList) {
    validateColumnList(columnList);
    final boolean hasPrefix = beanName != null;
    final String beanPrefix = (hasPrefix ? beanName + "." : "");
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguageImplStyle implStyle = lang.getLanguageImplStyle();
    String result = "";
    for (Iterator<Column> ite = columnList.iterator(); ite.hasNext(); ) {
        final Column column = (Column) ite.next();
        final String javaName = column.getJavaName();
        final String variable = column.getUncapitalisedJavaName();
        final String cls = column.getClassificationName();
        final String basic;
        if (column.isForceClassificationSetting()) {
            basic = "set" + javaName + "As" + cls + "(" + variable + ")";
        } else {
            basic = "set" + javaName + "(" + variable + ")";
        }
        final String adjusted = implStyle.adjustEntitySetPropertyCall(basic, !hasPrefix);
        final String setter = beanPrefix + adjusted + ";";
        if ("".equals(result)) {
            result = setter;
        } else {
            result = result + setter;
        }
    }
    return result;
}
Also used : Column(org.apache.torque.engine.database.model.Column) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 2 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfLittleAdjustmentProperties method getBasicOptionalEntityClass.

// -----------------------------------------------------
// Basic Optional
// --------------
public String getBasicOptionalEntityClass() {
    // closet
    final DfLanguageImplStyle implStyle = getLanguageDependency().getLanguageImplStyle();
    final String langClass = implStyle.getBasicOptionalEntityClass();
    final String embedded = getOptionalEntityDBFluteEmbeddedClassName();
    return getProperty("basicOptionalEntityClass", langClass != null ? langClass : embedded);
}
Also used : DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 3 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class Table method buildCommonColumnListSetupExpression.

protected String buildCommonColumnListSetupExpression(List<Column> commonColumnList) {
    final DfLanguageImplStyle implStyle = getLanguageDependency().getLanguageImplStyle();
    final DfLanguageGrammar grammar = getLanguageGrammar();
    final StringBuilder sb = new StringBuilder();
    int index = 0;
    for (Column column : commonColumnList) {
        if (index > 0) {
            sb.append(", ");
        }
        final String resourceName = "column" + column.getJavaName();
        final String callExp;
        if (implStyle.isDBMetaColumnGetterProperty()) {
            callExp = grammar.buildPropertyGetterCall(resourceName);
        } else {
            // method style
            callExp = resourceName + "()";
        }
        sb.append(callExp);
        ++index;
    }
    return sb.toString();
}
Also used : DfColumnListToStringBuilder(org.dbflute.logic.generate.column.DfColumnListToStringBuilder) DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 4 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfPmbGenerationHandler method getInterfaceDefinition.

public String getInterfaceDefinition(String className) {
    assertArgumentPmbMetaDataClassName(className);
    final DfLanguageImplStyle implStyle = getLanguageImplStyle();
    if (!implStyle.isTypedParameterBeanEnabled()) {
        return "";
    }
    final boolean immutable = implStyle.isMakeImmutableEntity();
    final String immuPrefix = immutable ? "Immutable" : "";
    final DfLanguageGrammar grammar = getLanguageGrammar();
    final String delimiter = grammar.getImplementsDelimiter();
    final StringBuilder sb = new StringBuilder();
    if (isTypedParameterBean(className)) {
        final String bhvType = getBehaviorClassName(className);
        final String customizeType;
        final String immuType;
        if (isRelatedToCustomizeEntity(className)) {
            customizeType = getCustomizeEntityType(className);
            immuType = immutable ? getImmutableCustomizeEntityType(className) : null;
        } else {
            // these are no used
            customizeType = null;
            immuType = null;
        }
        final String entityGenericDef = prepareEntityGenericDef(immutable, bhvType, customizeType, immuType);
        final String voidResultGenericDef = prepareVoidResultGenericDef(immutable, bhvType, customizeType, immuType);
        final String noResultGenericDef = grammar.buildGenericOneClassHint(bhvType);
        // several typed interfaces can be implemented
        if (isTypedListHandling(className)) {
            final String name = ListHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name).append(entityGenericDef);
        }
        if (isTypedEntityHandling(className)) {
            final String name = EntityHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name).append(entityGenericDef);
        }
        if (isTypedManualPagingHandling(className)) {
            final String name = ManualPagingHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name).append(entityGenericDef);
        }
        if (isTypedAutoPagingHandling(className)) {
            final String name = AutoPagingHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name).append(entityGenericDef);
        }
        if (isTypedCursorHandling(className)) {
            final String name = CursorHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name);
            if (isTypedPagingHandling(className)) {
                // cursor with paging
                sb.append(entityGenericDef);
            } else {
                // pure cursor
                sb.append(voidResultGenericDef);
            }
        }
        if (isTypedExecuteHandling(className)) {
            final String name = ExecuteHandlingPmb.class.getSimpleName();
            sb.append(delimiter).append(immuPrefix);
            sb.append(name).append(noResultGenericDef);
        }
    }
    if (sb.length() > 0) {
        sb.delete(0, delimiter.length());
    } else {
        sb.append("ParameterBean");
    }
    sb.append(delimiter).append("FetchBean");
    final String implementsMark = grammar.getImplementsMark();
    final String implementsPrefix;
    if (grammar.isSameAreaExtendsImplements()) {
        final String superClassDefinition = getSuperClassDefinition(className);
        final boolean hasSuperClassDefinition = Srl.is_NotNull_and_NotTrimmedEmpty(superClassDefinition);
        if (hasSuperClassDefinition) {
            // e.g. extends SimplePagingBean| with |Immutable...
            implementsPrefix = delimiter;
        } else {
            implementsPrefix = " " + implementsMark + " ";
        }
    } else {
        implementsPrefix = " " + implementsMark + " ";
    }
    return implementsPrefix + sb.toString();
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 5 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfLittleAdjustmentProperties method getRelationOptionalEntityClass.

public String getRelationOptionalEntityClass() {
    // closet
    // you should also override RelationOptionalFactory if you change this
    final DfLanguageImplStyle implStyle = getLanguageDependency().getLanguageImplStyle();
    final String langClass = implStyle.getRelationOptionalEntityClass();
    final String embedded = getOptionalEntityDBFluteEmbeddedClassName();
    return getProperty("relationOptionalEntityClass", langClass != null ? langClass : embedded);
}
Also used : DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Aggregations

DfLanguageImplStyle (org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)8 Column (org.apache.torque.engine.database.model.Column)3 DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)3 DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)2 DfColumnListToStringBuilder (org.dbflute.logic.generate.column.DfColumnListToStringBuilder)1 DfOutsideSqlChecker (org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)1