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


Java Syntax类代码示例

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


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

示例1: toSQL

import javax.annotation.Syntax; //导入依赖的package包/类
@Nonnull
@Syntax("SQL")
public String toSQL(@Nonnull final JDBCDriver driver, @Nullable final String tableName)
{
	if(isValue)
	{
		if(data != null && data.getClass().isArray())
		{
			if(((Object[])data).length == 0)
			{
				//Matching item to empty list is not supported by SQL
				return "(NULL)";
			}
			//see: https://stackoverflow.com/questions/178479/preparedstatement-in-clause-alternatives
			return "("+Arrays.stream( (Object[])data).map( (final Object o) -> "?").collect( Collectors.joining( ", "))+")";
		}
		return "?";
	}
	if(data instanceof SQLFunction)
	{
		return ((SQLFunction)data).toSQL( driver, tableName );
	}
	return (String)(tableName != null ? tableName + "." + data : data);
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:25,代码来源:SimpleCondition.java

示例2: getIndexKeyword

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * NOTE: If the specified {@link IndexType} is not supported by the driver,
 * fallback to the {@link IndexType#DEFAULT default} index-type is allowed
 *
 * @param indexType the index-type to translate to driver-specific keyword
 * @return the keyword for the given index-type
 * @since 0.6
 */
@Nonnull
@Syntax(value = "SQL")
public String getIndexKeyword(@Nonnull final IndexType indexType)
{
	switch(indexType)
	{
		case DEFAULT:
			return "";
		case UNIQUE:
			return "UNIQUE";
		case CLUSTERED:
			return "CLUSTERED";
		default:
			throw new AssertionError( indexType.name() );
	}
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:25,代码来源:JDBCDriver.java

示例3: getLimitClause

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @param offset the offset to start at
 * @param limit the maximum number of results
 * @return the SQL-clause to limit the amount of retrieved results
 */
@Nonnull
@Syntax(value = "SQL")
public String getLimitClause(@Nonnegative final int offset, @Signed final int limit)
{
	return (offset > 0 ? "OFFSET " + offset + " " : "") + (limit > 0 ? "FETCH FIRST " + limit + " ROWS ONLY" : "");
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:12,代码来源:JDBCDriver.java

示例4: getSQLFunction

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @param sqlFunction the SQL-function to apply
 * @param column the column to aggregate
 * @return the SQL function for the given column
 */
@Nonnull
@Syntax(value = "SQL")
public String getSQLFunction(@Nonnull final String sqlFunction, @Nonnull final String column)
{
	return sqlFunction.replaceAll( "%column%", column);
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:12,代码来源:JDBCDriver.java

示例5: getPrimaryKeyKeywords

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * For the default-implementation, see: https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Data_structure_definition/Auto-increment_column
 *
 * @param primaryKeyKeywords the previously set keywords
 * @return the keywords for an auto-incremental primary-key column
 */
@Nonnull
@Syntax(value = "SQL")
public String getPrimaryKeyKeywords(@Nonnull final String primaryKeyKeywords)
{
	return primaryKeyKeywords + " GENERATED ALWAYS AS IDENTITY PRIMARY KEY";
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:13,代码来源:JDBCDriver.java

示例6: getStringDataType

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * The default implementation provides a 4kB string-column
 *
 * @return the default data-type for strings
 */
@Nonnull
@Syntax(value = "SQL")
public String getStringDataType()
{
	return "VARCHAR("+JDBCDriver.STRING_TYPE_LENGTH+")";
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:12,代码来源:JDBCDriver.java

示例7: getInsertDataForEmptyRow

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * The default implementation inserts a <code>NULL</code>-value for the <code>primaryColumn</code>
 *
 * @param primaryColumn the primaryColumn
 * @return the columns-and-values string for an empty row
 */
@Nonnull
@Syntax(value = "SQL")
public String getInsertDataForEmptyRow(@Nonnull final String primaryColumn)
{
	return "(" + primaryColumn + ") VALUES (NULL)";
}
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:13,代码来源:JDBCDriver.java

示例8: decodeObject

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * Tries to parse the string as an isolated typesafe-config object, tries to resolve it, and then calls
 * {@link #decodeObject(String, Config)} with the resultant config and the passed in category. Pretty much just
 * a convenience function for simple use cases that don't want to care about how ConfigFactory works.
 */
public <T> T decodeObject(@Nonnull String category, @Syntax("HOCON") String configText)
        throws JsonProcessingException, IOException {
    PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                     "could not find anything about the category %s", category);
    Config config = ConfigFactory.parseString(configText).resolve();
    return (T) decodeObject(pluginMap.baseClass(), config);
}
 
开发者ID:addthis,项目名称:codec,代码行数:13,代码来源:CodecJackson.java

示例9: decodeMap

import javax.annotation.Syntax; //导入依赖的package包/类
public static ValueMap decodeMap(@Syntax("HOCON") String config) throws IOException {
    return Configs.decodeObject(ValueMap.class, config);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:4,代码来源:ValueFactory.java

示例10: decode

import javax.annotation.Syntax; //导入依赖的package包/类
public static MapBundle decode(@Syntax("HOCON") String config) throws IOException {
    return Configs.decodeObject(MapBundle.class, config);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:4,代码来源:MapBundle.java

示例11: decode

import javax.annotation.Syntax; //导入依赖的package包/类
@Scaling(SETUP)
public static Bundle decode(@Syntax("HOCON") String config) throws IOException {
    return Configs.decodeObject(Bundle.class, config);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:5,代码来源:Bundles.java

示例12: toSQL

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @param driver the driver for the underlying RDBMS
 * @param tableName the name to use to uniquely identify the table
 * @return a SQL representation of this Order
 */
@Syntax(value = "SQL")
public String toSQL(@Nonnull final JDBCDriver driver, @Nullable final String tableName);
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:8,代码来源:Order.java

示例13: toSQL

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @param driver the driver to be used for vendor-specific commands
 * @param tableName the name of the table to apply this function to
 * @return the SQL representation of this function
 */
@Nonnull
@Syntax(value = "SQL")
public String toSQL(@Nonnull final JDBCDriver driver, @Nullable final String tableName);
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:9,代码来源:SQLFunction.java

示例14: toSQL

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @param driver the vendor-specific driver
 * @param tableName the name to use to uniquely identify the table
 * @return the SQL representation of this condition
 */
@Nonnull
@Syntax(value = "SQL")
public String toSQL(@Nonnull final JDBCDriver driver, @Nullable final String tableName);
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:9,代码来源:Condition.java

示例15: toSQL

import javax.annotation.Syntax; //导入依赖的package包/类
/**
 * @return the SQL-representation of this order
 */
@Syntax(value = "SQL")
public abstract String toSQL();
 
开发者ID:doe300,项目名称:jactiverecord,代码行数:6,代码来源:SimpleOrder.java


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