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


Java Embedded类代码示例

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


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

示例1: isExist

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
 *
 * @param keys arrays path to managedAttr separated by dots
 * @param embeddable next intrinsic element , incremented in each recursion
 */
private static boolean isExist(String[] keys, Embeddable embeddable) {
    if(embeddable==null){
        return false;
    }
    if (keys.length > 1) {
        Optional<Embedded> embeddedOptional = embeddable.getAttributes().getEmbedded().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        if (embeddedOptional.isPresent()) {
            return isExist(Arrays.copyOfRange(keys, 1, keys.length), embeddedOptional.get().getConnectedClass());
        } else {
            return false;
        }
    } else {
        Optional<Attribute> attrOptional = embeddable.getAttributes().getNonRelationAttributes().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        return attrOptional.isPresent();
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:22,代码来源:AttributeValidator.java

示例2: isExist

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
 *
 * @param keys arrays path to managedAttr separated by dots
 * @param embeddable next intrinsic element , incremented in each recursion
 */
private static boolean isExist(String[] keys, Embeddable embeddable, AssociationOverride associationOverride) {
    if (keys.length > 1) {
        Optional<Embedded> embeddedOptional = embeddable.getAttributes().getEmbedded().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        if (embeddedOptional.isPresent()) {
            return isExist(Arrays.copyOfRange(keys, 1, keys.length), embeddedOptional.get().getConnectedClass(), associationOverride);
        } else {
            return false;
        }
    } else {
        Optional<RelationAttribute> attrOptional = embeddable.getAttributes().getRelationAttributes().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        if (attrOptional.isPresent()) {
            RelationAttribute attribute = attrOptional.get();
            if (attribute instanceof SingleRelationAttribute) {
                associationOverride.getJoinTable().clear();
            } else if (attribute instanceof MultiRelationAttribute) {
                if (attribute instanceof OneToMany) {
                    associationOverride.getJoinColumn().clear();
                }
            }
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:31,代码来源:AssociationValidator.java

示例3: getKeyName

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
protected String getKeyName() {
    if (keyName != null) {
        return keyName;
    }
    StringBuilder keyNameBuilder = new StringBuilder();
    boolean skipFirst = true;
    for (Embedded next : embeddedList) {
        if (skipFirst) {
            skipFirst = false;
            continue;
        }
        keyNameBuilder.append(next.getName()).append('.');
    }
    keyNameBuilder.append(getAttribute().getName());
    return keyName = keyNameBuilder.toString();
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:17,代码来源:DBEmbeddedColumn.java

示例4: processEmbedded

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
protected void processEmbedded(List<Embedded> parsedEmbeddeds) {

        if (parsedEmbeddeds == null) {
            return;
        }
        for (Embedded parsedEmbeded : parsedEmbeddeds) {
            VariableDefSnippet variableDef = getVariableDef(parsedEmbeded);

            variableDef.setEmbedded(true);
            variableDef.setType(parsedEmbeded.getConnectedClass().getAbsolutePackage(rootPackageName) + ORMConverterUtil.DOT
                    + parsedEmbeded.getAttributeType());
            variableDef.setFunctionalType(parsedEmbeded.isOptionalReturnType());
            variableDef.setConverts(processConverts(parsedEmbeded.getConverts()));
            processInternalAttributeOverride(variableDef, parsedEmbeded.getAttributeOverride());
            processInternalAssociationOverride(variableDef, parsedEmbeded.getAssociationOverride());
        }
    }
 
开发者ID:jeddict,项目名称:jeddict,代码行数:18,代码来源:ClassGenerator.java

示例5: filter

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
 * Used to remove all stale AttributeOverride (ex : if Embeddable attribute
 * is removed then AttributeOverride reference should be removed)
 *
 * @param embedded
 */
public static void filter(Embedded embedded) {
    embedded.getAttributeOverride().removeIf(attributeOverride
            -> !isExist(attributeOverride.getName().split("\\."), embedded.getConnectedClass())
            || AttributeValidator.isEmpty(attributeOverride)
    );
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:13,代码来源:AttributeValidator.java

示例6: getEmbedded

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public Optional<Embedded> getEmbedded(String id) {
    if (embedded != null) {
        return embedded.stream().filter(a -> a.getId().equals(id)).findFirst();
    }
    return null;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:8,代码来源:PersistenceAttributes.java

示例7: addEmbedded

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public void addEmbedded(Embedded embedded) {
    if (embedded != null) {
        this.getEmbedded().add(embedded);
        notifyListeners(embedded, "addAttribute", null, null);
        embedded.setAttributes(this);
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:9,代码来源:PersistenceAttributes.java

示例8: getRelationConnectedClassRef

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public Set<Entity> getRelationConnectedClassRef() {
    Set<Entity> javaClasses = getRelationAttributes().stream()
            .map(RelationAttribute::getConnectedEntity)
            .collect(toSet());
    javaClasses.addAll(getEmbedded().stream()
            .map(Embedded::getConnectedClass)
            .flatMap(c -> c.getAttributes().getRelationConnectedClassRef().stream())
            .collect(toSet()));
    return javaClasses;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:12,代码来源:PersistenceAttributes.java

示例9: getEmbeddedConnectedClass

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public Set<String> getEmbeddedConnectedClass(Set<String> javaClasses){
    Map<ManagedClass, String> releationClasses = getEmbedded().stream()
            .map(Embedded::getConnectedClass)
            .distinct()
            .filter(jc -> !javaClasses.contains(jc.getFQN()))
            .collect(toMap(identity(), JavaClass::getFQN));
    javaClasses.addAll(releationClasses.values());
    for (ManagedClass releationClass : releationClasses.keySet()) {
        javaClasses.addAll(releationClass.getAttributes().getConnectedClass(javaClasses));
    }
    return javaClasses;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:13,代码来源:PersistenceAttributes.java

示例10: getInstance

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public static EmbeddedSpecAccessor getInstance(Embedded embedded, boolean inherit) {
    EmbeddedSpecAccessor accessor = new EmbeddedSpecAccessor(embedded);
    accessor.inherit = inherit;
    accessor.setName(embedded.getName());
    accessor.setAttributeType(embedded.getAttributeType());
    AttributeValidator.filter(embedded);
    accessor.setAttributeOverrides(embedded.getAttributeOverride().stream().map(AttributeOverrideSpecMetadata::getInstance).collect(toList()));
    AssociationValidator.filter(embedded);
    accessor.setAssociationOverrides(embedded.getAssociationOverride().stream().map(AssociationOverrideSpecMetadata::getInstance).collect(toList()));
    accessor.setConverts(embedded.getConverts().stream().map(Convert::getAccessor).collect(toList()));
    return accessor;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:13,代码来源:EmbeddedSpecAccessor.java

示例11: loadAttribute

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public void loadAttribute() {
    List<JSONBNode> nodes = new LinkedList<>();
    List<Attribute> attributes = this.javaClass.getAttributes().getAllAttribute();
    List<Attribute> propertyOrder = this.javaClass.getJsonbPropertyOrder();
    if (!propertyOrder.isEmpty()) {
        Map<String, Integer> attributesMap = IntStream.range(0, propertyOrder.size())
                .boxed()
                .collect(toMap(i -> propertyOrder.get(i).getId(), identity()));
        attributes.sort(Comparator.comparing(attr -> attributesMap.get(attr.getId())));
    }

    for (Attribute attribute : attributes) {
        JSONBNode node = null;

        if (attribute instanceof RelationAttribute) {
            if (workSpace == null || workSpace.hasItem(((RelationAttribute) attribute).getConnectedEntity())) {
                node = new JSONBBranchNode(attribute);
            }
        } else if (attribute instanceof Embedded) {
            if (workSpace == null || workSpace.hasItem(((Embedded) attribute).getConnectedClass())) {
                node = new JSONBBranchNode(attribute);
            }
        } else if (attribute instanceof ElementCollection && ((ElementCollection) attribute).getConnectedClass() != null) {
            if (workSpace == null || workSpace.hasItem(((ElementCollection) attribute).getConnectedClass())) {
                node = new JSONBBranchNode(attribute);
            }
        } else {
            node = new JSONBLeafNode(attribute);
        }
        if (node != null) {
            nodes.add(node);
        }
    }
    this.nodes = nodes;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:36,代码来源:JSONBDocument.java

示例12: getJSONNodeWidget

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
 * @return the JSONNodeWidget
 */
public JSONNodeWidget getJSONNodeWidget(Attribute attr) {
    if(attr instanceof RelationAttribute || attr instanceof Embedded || 
            (attr instanceof ElementCollection && ((ElementCollection)attr).getConnectedClass()!=null)){
        return branchNodeWidgets.get(attr.getId());
    } else {
       return leafNodeWidgets.get(attr.getId()); 
    }
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:12,代码来源:DocumentWidget.java

示例13: buildMapKeyColumn

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
private DBColumn buildMapKeyColumn() {
    DBColumn column;
    MapKeyHandler mapKeyHandler = (MapKeyHandler) intrinsicAttribute.peek();
    if (mapKeyHandler.getMapKeyEntity() != null) {
        column = new DBMapKeyJoinColumn(name, managedAttribute);
    } else if (mapKeyHandler.getMapKeyEmbeddable() != null) {
        // Wrap AttributeOverride to Embedded to reuse the api
        column = new DBMapKeyEmbeddedColumn(name, Collections.singletonList(new Embedded(mapKeyHandler.getMapKeyAttributeOverride())), managedAttribute);
    } else {
        column = new DBMapKeyColumn(name, managedAttribute);
    }
    return column;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:14,代码来源:JPAMFieldDefinition.java

示例14: DBEmbeddedAssociationJoinColumn

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public DBEmbeddedAssociationJoinColumn(String name, List<Embedded> embeddedList, RelationAttribute managedAttribute, boolean relationTableExist) {
    super(name, embeddedList, managedAttribute, relationTableExist);

    joinColumnsOverride = JoinColumnFinder.findJoinColumns(associationOverride, managedAttribute, relationTableExist, false);
    joinColumnOverride = JoinColumnFinder.findJoinColumn(name, joinColumnsOverride);

    joinColumns = JoinColumnFinder.findJoinColumns(managedAttribute, relationTableExist, false);
    joinColumn = JoinColumnFinder.findJoinColumn(name, joinColumns);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:10,代码来源:DBEmbeddedAssociationJoinColumn.java

示例15: DBEmbeddedAssociationInverseJoinColumn

import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public DBEmbeddedAssociationInverseJoinColumn(String name, List<Embedded> embeddedList, RelationAttribute managedAttribute, boolean relationTableExist) {
    super(name, embeddedList, managedAttribute, relationTableExist);
    joinColumnsOverride = JoinColumnFinder.findJoinColumns(associationOverride, managedAttribute, relationTableExist, true);
    joinColumnOverride = JoinColumnFinder.findJoinColumn(name, joinColumnsOverride);

    joinColumns = JoinColumnFinder.findJoinColumns(managedAttribute, relationTableExist, true);
    joinColumn = JoinColumnFinder.findJoinColumn(name, joinColumns);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:9,代码来源:DBEmbeddedAssociationInverseJoinColumn.java


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