本文整理汇总了Java中org.apache.ignite.cache.query.annotations.QuerySqlField类的典型用法代码示例。如果您正苦于以下问题:Java QuerySqlField类的具体用法?Java QuerySqlField怎么用?Java QuerySqlField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuerySqlField类属于org.apache.ignite.cache.query.annotations包,在下文中一共展示了QuerySqlField类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PojoField
import org.apache.ignite.cache.query.annotations.QuerySqlField; //导入依赖的package包/类
/**
* Creates instance of {@link PojoField} from its field accessor.
*
* @param accessor field accessor.
*/
public PojoField(PojoFieldAccessor accessor) {
this.name = accessor.getName();
QuerySqlField sqlField = (QuerySqlField)accessor.getAnnotation(QuerySqlField.class);
col = sqlField != null && sqlField.name() != null && !sqlField.name().isEmpty() ?
sqlField.name() : name.toLowerCase();
init(accessor);
}
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:PojoField.java
示例2: PojoValueField
import org.apache.ignite.cache.query.annotations.QuerySqlField; //导入依赖的package包/类
/**
* Constructs Ignite cache value field descriptor.
*
* @param accessor field property accessor.
*/
public PojoValueField(PojoFieldAccessor accessor) {
super(accessor);
QuerySqlField sqlField = (QuerySqlField)accessor.getAnnotation(QuerySqlField.class);
isIndexed = sqlField != null && sqlField.index();
}
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:PojoValueField.java
示例3: PojoKeyField
import org.apache.ignite.cache.query.annotations.QuerySqlField; //导入依赖的package包/类
/**
* Constructs Ignite cache key POJO object descriptor.
*
* @param accessor property descriptor.
*/
public PojoKeyField(PojoFieldAccessor accessor) {
super(accessor);
QuerySqlField sqlField = (QuerySqlField)accessor.getAnnotation(QuerySqlField.class);
if (sqlField != null && sqlField.descending())
sortOrder = SortOrder.DESC;
}
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:PojoKeyField.java
示例4: processAnnotationsInClass
import org.apache.ignite.cache.query.annotations.QuerySqlField; //导入依赖的package包/类
/**
* Process annotations for class.
*
* @param key If given class relates to key.
* @param cls Class.
* @param type Type descriptor.
* @param parent Parent in case of embeddable.
*/
private static void processAnnotationsInClass(boolean key, Class<?> cls, QueryEntityTypeDescriptor type,
@Nullable QueryEntityClassProperty parent) {
if (U.isJdk(cls) || QueryUtils.isGeometryClass(cls)) {
if (parent == null && !key && QueryUtils.isSqlType(cls)) { // We have to index primitive _val.
String idxName = cls.getSimpleName() + "_" + QueryUtils.VAL_FIELD_NAME + "_idx";
type.addIndex(idxName, QueryUtils.isGeometryClass(cls) ?
QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, QueryIndex.DFLT_INLINE_SIZE);
type.addFieldToIndex(idxName, QueryUtils.VAL_FIELD_NAME, 0, false);
}
return;
}
if (parent != null && parent.knowsClass(cls))
throw new CacheException("Recursive reference found in type: " + cls.getName());
if (parent == null) { // Check class annotation at top level only.
QueryTextField txtAnnCls = cls.getAnnotation(QueryTextField.class);
if (txtAnnCls != null)
type.valueTextIndex(true);
QueryGroupIndex grpIdx = cls.getAnnotation(QueryGroupIndex.class);
if (grpIdx != null)
type.addIndex(grpIdx.name(), QueryIndexType.SORTED, grpIdx.inlineSize());
QueryGroupIndex.List grpIdxList = cls.getAnnotation(QueryGroupIndex.List.class);
if (grpIdxList != null && !F.isEmpty(grpIdxList.value())) {
for (QueryGroupIndex idx : grpIdxList.value())
type.addIndex(idx.name(), QueryIndexType.SORTED, idx.inlineSize());
}
}
for (Class<?> c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) {
for (Field field : c.getDeclaredFields()) {
QuerySqlField sqlAnn = field.getAnnotation(QuerySqlField.class);
QueryTextField txtAnn = field.getAnnotation(QueryTextField.class);
if (sqlAnn != null || txtAnn != null) {
QueryEntityClassProperty prop = new QueryEntityClassProperty(field);
prop.parent(parent);
// Add parent property before its possible nested properties so that
// resulting parent column comes before columns corresponding to those
// nested properties in the resulting table - that way nested
// properties override will happen properly (first parent, then children).
type.addProperty(prop, key, true);
processAnnotation(key, sqlAnn, txtAnn, cls, c, field.getType(), prop, type);
}
}
}
}
开发者ID:apache,项目名称:ignite,代码行数:67,代码来源:QueryEntity.java
示例5: processAnnotation
import org.apache.ignite.cache.query.annotations.QuerySqlField; //导入依赖的package包/类
/**
* Processes annotation at field or method.
*
* @param key If given class relates to key.
* @param sqlAnn SQL annotation, can be {@code null}.
* @param txtAnn H2 text annotation, can be {@code null}.
* @param cls Entity class.
* @param curCls Current entity class.
* @param fldCls Class of field or return type for method.
* @param prop Current property.
* @param desc Class description.
*/
private static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTextField txtAnn,
Class<?> cls, Class<?> curCls, Class<?> fldCls, QueryEntityClassProperty prop, QueryEntityTypeDescriptor desc) {
if (sqlAnn != null) {
processAnnotationsInClass(key, fldCls, desc, prop);
if (!sqlAnn.name().isEmpty())
prop.alias(sqlAnn.name());
if (sqlAnn.index()) {
String idxName = curCls.getSimpleName() + "_" + prop.alias() + "_idx";
if (cls != curCls)
idxName = cls.getSimpleName() + "_" + idxName;
desc.addIndex(idxName, QueryUtils.isGeometryClass(prop.type()) ?
QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, sqlAnn.inlineSize());
desc.addFieldToIndex(idxName, prop.fullName(), 0, sqlAnn.descending());
}
if (sqlAnn.notNull())
desc.addNotNullField(prop.fullName());
if ((!F.isEmpty(sqlAnn.groups()) || !F.isEmpty(sqlAnn.orderedGroups()))
&& sqlAnn.inlineSize() != QueryIndex.DFLT_INLINE_SIZE) {
throw new CacheException("Inline size cannot be set on a field with group index [" +
"type=" + cls.getName() + ", property=" + prop.fullName() + ']');
}
if (!F.isEmpty(sqlAnn.groups())) {
for (String group : sqlAnn.groups())
desc.addFieldToIndex(group, prop.fullName(), 0, false);
}
if (!F.isEmpty(sqlAnn.orderedGroups())) {
for (QuerySqlField.Group idx : sqlAnn.orderedGroups())
desc.addFieldToIndex(idx.name(), prop.fullName(), idx.order(), idx.descending());
}
}
if (txtAnn != null)
desc.addFieldToTextIndex(prop.fullName());
}
开发者ID:apache,项目名称:ignite,代码行数:56,代码来源:QueryEntity.java
注:本文中的org.apache.ignite.cache.query.annotations.QuerySqlField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论