当前位置: 首页>>代码示例>>Java>>正文


Java Attribute类代码示例

本文整理汇总了Java中org.mybatis.generator.api.dom.xml.Attribute的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Attribute类属于org.mybatis.generator.api.dom.xml包,在下文中一共展示了Attribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sqlMapSelectByExampleWithoutBLOBsElementGenerated

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
/**
 * 为Mapper.xml的selectByExample添加limit,offset
 */
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element,
                                                                 IntrospectedTable introspectedTable) {

	XmlElement ifLimitNotNullElement = new XmlElement("if");
	ifLimitNotNullElement.addAttribute(new Attribute("test", "limit != null"));

	XmlElement ifOffsetNotNullElement = new XmlElement("if");
	ifOffsetNotNullElement.addAttribute(new Attribute("test", "offset != null"));
	ifOffsetNotNullElement.addElement(new TextElement("limit ${offset}, ${limit}"));
	ifLimitNotNullElement.addElement(ifOffsetNotNullElement);

	XmlElement ifOffsetNullElement = new XmlElement("if");
	ifOffsetNullElement.addAttribute(new Attribute("test", "offset == null"));
	ifOffsetNullElement.addElement(new TextElement("limit ${limit}"));
	ifLimitNotNullElement.addElement(ifOffsetNullElement);

	element.addElement(ifLimitNotNullElement);

	return true;
}
 
开发者ID:jmdhappy,项目名称:xxpay-master,代码行数:25,代码来源:PaginationPlugin.java

示例2: getSqlMapElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
protected XmlElement getSqlMapElement() {
    FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
    progressCallback.startTask(getString("Progress.12", table.toString())); //$NON-NLS-1$
    XmlElement answer = new XmlElement("mapper"); //$NON-NLS-1$
    String namespace = introspectedTable.getMyBatis3SqlMapNamespace();
    answer.addAttribute(new Attribute("namespace", //$NON-NLS-1$
            namespace));

    context.getCommentGenerator().addRootComment(answer);

    addResultMapElement(answer);
    addDeleteByPrimaryKeyElement(answer);
    addInsertElement(answer);
    addUpdateByPrimaryKeyElement(answer);
    addSelectByPrimaryKeyElement(answer);
    addSelectAllElement(answer);

    return answer;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:20,代码来源:SimpleXMLMapperGenerator.java

示例3: addElements

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("select"); //$NON-NLS-1$

    String fqjt = introspectedTable.getExampleType();

    answer.addAttribute(new Attribute(
            "id", introspectedTable.getCountByExampleStatementId())); //$NON-NLS-1$
    answer.addAttribute(new Attribute("parameterType", fqjt)); //$NON-NLS-1$
    answer.addAttribute(new Attribute("resultType", "java.lang.Long")); //$NON-NLS-1$ //$NON-NLS-2$

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("select count(*) from "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));
    answer.addElement(getExampleIncludeElement());

    if (context.getPlugins().sqlMapCountByExampleElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:26,代码来源:CountByExampleElementGenerator.java

示例4: addResultMapElements

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
private void addResultMapElements(XmlElement answer) {
    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getBLOBColumns()) {
        XmlElement resultElement = new XmlElement("result"); //$NON-NLS-1$

        resultElement
                .addAttribute(new Attribute(
                        "column", MyBatis3FormattingUtilities.getRenamedColumnNameForResultMap(introspectedColumn))); //$NON-NLS-1$
        resultElement.addAttribute(new Attribute(
                "property", introspectedColumn.getJavaProperty())); //$NON-NLS-1$
        resultElement.addAttribute(new Attribute(
                "jdbcType", introspectedColumn.getJdbcTypeName())); //$NON-NLS-1$

        if (stringHasValue(introspectedColumn
                .getTypeHandler())) {
            resultElement.addAttribute(new Attribute(
                    "typeHandler", introspectedColumn.getTypeHandler())); //$NON-NLS-1$
        }

        answer.addElement(resultElement);
    }
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:23,代码来源:ResultMapWithBLOBsElementGenerator.java

示例5: addElements

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("delete"); //$NON-NLS-1$

    String fqjt = introspectedTable.getExampleType();

    answer.addAttribute(new Attribute(
            "id", introspectedTable.getDeleteByExampleStatementId())); //$NON-NLS-1$
    answer.addAttribute(new Attribute("parameterType", fqjt)); //$NON-NLS-1$

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("delete from "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));
    answer.addElement(getExampleIncludeElement());

    if (context.getPlugins().sqlMapDeleteByExampleElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:25,代码来源:DeleteByExampleElementGenerator.java

示例6: copyAndSaveElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
/**
 * Use the method copy constructor to create a new element
 * 
 * @param fullyQualifiedTable
 * @param method
 */
private void copyAndSaveElement(XmlElement element, FullyQualifiedTable fqt) {
    XmlElement newElement = new XmlElement(element);
        
    // remove old id attribute and add a new one with the new name
    for (Iterator<Attribute> iterator = newElement.getAttributes().iterator(); iterator.hasNext();) {
        Attribute attribute = iterator.next();
        if ("id".equals(attribute.getName())) { //$NON-NLS-1$
            iterator.remove();
            Attribute newAttribute = new Attribute("id", attribute.getValue() + "WithRowbounds"); //$NON-NLS-1$ //$NON-NLS-2$
            newElement.addAttribute(newAttribute);
            break;
        }
    }
        
    // save the new element locally.   We'll add it to the document
    // later
    List<XmlElement> elements = elementsToAdd.get(fqt);
    if (elements == null) {
        elements = new ArrayList<XmlElement>();
        elementsToAdd.put(fqt, elements);
    }
    elements.add(newElement);
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:30,代码来源:RowBoundsPlugin.java

示例7: toXmlElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("jdbcConnection"); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("driverClass", driverClass)); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("connectionURL", connectionURL)); //$NON-NLS-1$

    if (stringHasValue(userId)) {
        xmlElement.addAttribute(new Attribute("userId", userId)); //$NON-NLS-1$
    }

    if (stringHasValue(password)) {
        xmlElement.addAttribute(new Attribute("password", password)); //$NON-NLS-1$
    }

    addPropertyXmlElements(xmlElement);

    return xmlElement;
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:18,代码来源:JDBCConnectionConfiguration.java

示例8: toXmlElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
public XmlElement toXmlElement() {
    XmlElement answer = new XmlElement("javaClientGenerator"); //$NON-NLS-1$
    if (getConfigurationType() != null) {
        answer.addAttribute(new Attribute("type", getConfigurationType())); //$NON-NLS-1$
    }

    if (targetPackage != null) {
        answer.addAttribute(new Attribute("targetPackage", targetPackage)); //$NON-NLS-1$
    }

    if (targetProject != null) {
        answer.addAttribute(new Attribute("targetProject", targetProject)); //$NON-NLS-1$
    }

    if (implementationPackage != null) {
        answer.addAttribute(new Attribute(
                "implementationPackage", targetProject)); //$NON-NLS-1$
    }

    addPropertyXmlElements(answer);

    return answer;
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:24,代码来源:JavaClientGeneratorConfiguration.java

示例9: toDocument

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
/**
 * Builds an XML representation of this configuration. This can be used to
 * persist a programmatically generated configuration.
 * 
 * @return the XML representation of this configuration
 */
public Document toDocument() {
    // note that this method will not reconstruct a properties
    // element - that element is only used in XML parsing

    Document document = new Document(
            XmlConstants.MYBATIS_GENERATOR_CONFIG_PUBLIC_ID,
            XmlConstants.MYBATIS_GENERATOR_CONFIG_SYSTEM_ID);
    XmlElement rootElement = new XmlElement("generatorConfiguration"); //$NON-NLS-1$
    document.setRootElement(rootElement);

    for (String classPathEntry : classPathEntries) {
        XmlElement cpeElement = new XmlElement("classPathEntry"); //$NON-NLS-1$
        cpeElement.addAttribute(new Attribute("location", classPathEntry)); //$NON-NLS-1$
        rootElement.addElement(cpeElement);
    }

    for (Context context : contexts) {
        rootElement.addElement(context.toXmlElement());
    }

    return document;
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:29,代码来源:Configuration.java

示例10: generateLimitElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
/**
 * 生成limit节点
 *
 * @param element
 * @param introspectedTable
 */
public void generateLimitElement(XmlElement element, IntrospectedTable introspectedTable){
    XmlElement ifLimitNotNullElement = new XmlElement("if");
    ifLimitNotNullElement.addAttribute(new Attribute("test", "rows != null"));

    XmlElement ifOffsetNotNullElement = new XmlElement("if");
    ifOffsetNotNullElement.addAttribute(new Attribute("test", "offset != null"));
    ifOffsetNotNullElement.addElement(new TextElement("limit ${offset}, ${rows}"));
    ifLimitNotNullElement.addElement(ifOffsetNotNullElement);

    XmlElement ifOffsetNullElement = new XmlElement("if");
    ifOffsetNullElement.addAttribute(new Attribute("test", "offset == null"));
    ifOffsetNullElement.addElement(new TextElement("limit ${rows}"));
    ifLimitNotNullElement.addElement(ifOffsetNullElement);

    element.addElement(ifLimitNotNullElement);

    logger.debug("itfsw(MySQL分页插件):"+introspectedTable.getMyBatis3XmlMapperFileName()+"selectByExample方法增加分页条件。");
}
 
开发者ID:itfsw,项目名称:mybatis-generator-plugin,代码行数:25,代码来源:LimitPlugin.java

示例11: sqlMapSelectByExampleWithoutBLOBsElementGenerated

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
	XmlElement isNotNullElement = new XmlElement("if");
	isNotNullElement.addAttribute(new Attribute("test", "limitStart != null and limitStart >=0"));
	isNotNullElement.addElement(new TextElement("limit ${limitStart} , ${pageSize}"));
	element.addElement(isNotNullElement);
	return super.sqlMapSelectByExampleWithoutBLOBsElementGenerated(element, introspectedTable);
}
 
开发者ID:dianbaer,项目名称:anychat,代码行数:9,代码来源:PaginationPlugin.java

示例12: contextGenerateAdditionalXmlFiles

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
@Override
public List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles() {
	Document document = new Document("-//mybatis.org//DTD Config 3.0//EN", "http://mybatis" +
			".org/dtd/mybatis-3-config.dtd");
	XmlElement root = new XmlElement("configuration");
	document.setRootElement(root);
	root.addElement(new TextElement("<!--"));
	root.addElement(new TextElement("  This file is generated by MyBatis Generator."));
	root.addElement(new TextElement("-->"));
	XmlElement mappers = new XmlElement("mappers");
	root.addElement(mappers);
	Iterator var6 = this.mapperFiles.iterator();

	while (var6.hasNext()) {
		String mapperFile = (String) var6.next();
		XmlElement mapper = new XmlElement("mapper");
		mapper.addAttribute(new Attribute("resource", mapperFile));
		mappers.addElement(mapper);
	}

	GeneratedXmlFile gxf = new GeneratedXmlFile(document, this.properties.getProperty("fileName", "MapperConfig" +
			".xml"), this.properties.getProperty("targetPackage"), this.properties.getProperty("targetProject"),
			false, this.context.getXmlFormatter());
	List<GeneratedXmlFile> answer = new ArrayList(1);
	answer.add(gxf);
	return answer;
}
 
开发者ID:ychaoyang,项目名称:autotest,代码行数:28,代码来源:MapperConfigPlugin.java

示例13: getUpdateByExampleIncludeElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
protected XmlElement getUpdateByExampleIncludeElement() {
    XmlElement ifElement = new XmlElement("if"); //$NON-NLS-1$
    ifElement.addAttribute(new Attribute("test", "_parameter != null")); //$NON-NLS-1$ //$NON-NLS-2$

    XmlElement includeElement = new XmlElement("include"); //$NON-NLS-1$
    includeElement.addAttribute(new Attribute("refid", //$NON-NLS-1$
            introspectedTable.getMyBatis3UpdateByExampleWhereClauseId()));
    ifElement.addElement(includeElement);

    return ifElement;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:12,代码来源:AbstractXmlElementGenerator.java

示例14: getSqlMapElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
private XmlElement getSqlMapElement(CommentGenerator commentGenerator) {

        XmlElement answer = new XmlElement("mapper");
        String namespace = "org.mybatis.test.TestMapper";
        answer.addAttribute(new Attribute("namespace", namespace));

        commentGenerator.addRootComment(answer);

        addInsertElement(commentGenerator, answer);
        addCdataNode1(commentGenerator, answer);
        addCdataNode2(commentGenerator, answer);

        return answer;
    }
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:15,代码来源:XmlFileMergerTest.java

示例15: toXmlElement

import org.mybatis.generator.api.dom.xml.Attribute; //导入依赖的package包/类
@Override
public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("except"); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("column", columnName)); //$NON-NLS-1$

    if (stringHasValue(configuredDelimitedColumnName)) {
        xmlElement.addAttribute(new Attribute(
                "delimitedColumnName", configuredDelimitedColumnName)); //$NON-NLS-1$
    }

    return xmlElement;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:13,代码来源:IgnoredColumnException.java


注:本文中的org.mybatis.generator.api.dom.xml.Attribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。