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


Java Element类代码示例

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


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

示例1: processChildDefinition

import javax.jdo.annotations.Element; //导入依赖的package包/类
protected void processChildDefinition(JType jType, ChildDefinition childDefinition) {
	String trtLabel = childDefinition.range.name().toLowerCase() + "s";
	JDefinedClass jDefinedClass = (JDefinedClass) jType;
	if (jDefinedClass.fields().get(trtLabel) != null) {
		return;
	}
	JVar init = jDefinedClass
			.field(JMod.PRIVATE, context.getCodeModel().ref(Set.class).narrow(childDefinition.child), trtLabel)
			.init(JExpr._new(context.getCodeModel().ref(HashSet.class)));
	init.annotate(Element.class).param("dependent", "true");
	init.annotate(VisibleWhen.class).param("value", "+none");
	// System.out.println(jType);
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:14,代码来源:ImplementationGenerator.java

示例2: addManyToManyMetadata

import javax.jdo.annotations.Element; //导入依赖的package包/类
private void addManyToManyMetadata(FieldMetadata fmd, RelationshipHolder holder, EntityDto entity, FieldDto field,
                                   Class<?> definition) {
    // If tables and column names have been specified in annotations, do not set their metadata
    // Join metadata must be present at exactly one side of the M:N relation when using Sets
    // When using Lists join metadata must be present at two sides of M:N relation
    if (!holder.isOwningSide() || holder.isListManyToMany()) {
        java.lang.reflect.Field fieldDefinition = FieldUtils.getDeclaredField(definition, field.getBasic().getName(),
                true);

        Join join = fieldDefinition.getAnnotation(Join.class);
        Persistent persistent = fieldDefinition.getAnnotation(Persistent.class);
        Element element = fieldDefinition.getAnnotation(Element.class);

        JoinMetadata jmd = null;

        if (join == null) {
            jmd = fmd.newJoinMetadata();
        }

        setTableNameMetadata(fmd, persistent, entity, field, holder, EntityType.STANDARD);
        setElementMetadata(fmd, element, holder, entity);

        if (join == null || StringUtils.isEmpty(join.column())) {
            setJoinMetadata(jmd, fmd, ClassName.getSimpleName(entity.getClassName()).toUpperCase() + ID_SUFFIX);
            ForeignKeyMetadata fkmd = getOrCreateFkMetadata(jmd);
            fkmd.setName(KeyNames.foreignKeyName(entity.getName(), entity.getId(), field.getBasic().getName(),
                    EntityType.STANDARD));
        }
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:31,代码来源:EntityMetadataBuilderImpl.java

示例3: setElementMetadata

import javax.jdo.annotations.Element; //导入依赖的package包/类
private void setElementMetadata(FieldMetadata fmd, Element element, RelationshipHolder holder, EntityDto entity) {
    if (element == null || StringUtils.isEmpty(element.column())) {
        ElementMetadata emd = fmd.newElementMetadata();
        emd.setColumn((ClassName.getSimpleName(holder.getRelatedClass()) + ID_SUFFIX).toUpperCase());
        ForeignKeyMetadata fkmd = emd.newForeignKeyMetadata();
        fkmd.setName(KeyNames.foreignKeyName(ClassName.getSimpleName(holder.getRelatedClass()), entity.getId(),
                holder.getRelatedField(), EntityType.STANDARD));
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:EntityMetadataBuilderImpl.java


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