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


Java Embeddable类代码示例

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


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

示例1: isExist

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的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

示例2: isExist

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的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

示例3: generateEmbededClasses

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private void generateEmbededClasses()
        throws InvalidDataException, IOException {

    List<Embeddable> parsedEmbeddables
            = parsedEntityMappings.getEmbeddable();

    for (Embeddable parsedEmbeddable : parsedEmbeddables) {
        task.log("Generating Embeddable Class : " + parsedEmbeddable.getClazz(), true);

        ClassDefSnippet classDef = new EmbeddableGenerator(
                parsedEmbeddable, packageName).getClassDef();

        classesRepository.addWritableSnippet(
                ClassType.EMBEDED_CLASS, classDef);

        writeSnippet(classDef);
    }
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:19,代码来源:ORM2Java.java

示例4: getInstance

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
public static EmbeddableSpecAccessor getInstance(WorkSpace workSpace, Embeddable embeddable) {
    EmbeddableSpecAccessor accessor = new EmbeddableSpecAccessor(embeddable);
    accessor.setClassName(embeddable.getClazz());
    accessor.setAccess("VIRTUAL");
    accessor.setAttributes(embeddable.getAttributes().getAccessor(workSpace));
    if (embeddable.getSuperclass() != null) {
        accessor.setParentClassName(embeddable.getSuperclass().getClazz());
    }
    return accessor;

}
 
开发者ID:jeddict,项目名称:jCode,代码行数:12,代码来源:EmbeddableSpecAccessor.java

示例5: generateEmbededClasses

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private void generateEmbededClasses() throws InvalidDataException, IOException {
    List<Embeddable> parsedEmbeddables = entityMappings.getEmbeddable().stream().filter(e -> e.getGenerateSourceCode()).collect(toList());
    if(!parsedEmbeddables.isEmpty()){
        task.log(Console.wrap("Generating Embeddable Class : " , FG_RED, BOLD), true);
    }
    for (Embeddable parsedEmbeddable : parsedEmbeddables) {
        task.log(parsedEmbeddable.getClazz(), true);
        ManagedClassDefSnippet classDef = new EmbeddableGenerator(parsedEmbeddable, packageName).getClassDef();
        classDef.setJaxbSupport(entityMappings.getJaxbSupport());

        classesRepository.addWritableSnippet(ClassType.EMBEDED_CLASS, classDef);
        parsedEmbeddable.setFileObject(ORMConverterUtil.writeSnippet(classDef, destDir));
    }
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:15,代码来源:ManagedClassModuleGeneratorImpl.java

示例6: makeSiblingOrphan

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Deprecated
private static void makeSiblingOrphan(Embeddable embeddable) {
    EmbeddableAttributes attr = embeddable.getAttributes();
    attr.setManyToMany(null);
    attr.setManyToOne(null);
    attr.setOneToMany(null);
    attr.setOneToOne(null);
    attr.setEmbedded(null);
    attr.setElementCollection(null);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:11,代码来源:DBUtil.java

示例7: init

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
public void init() {
    super.init();
    Embeddable embeddable = this.getBaseElementSpec();
    if (embeddable.getAttributes() == null) {
        embeddable.setAttributes(new EmbeddableAttributes());
    }
    if (embeddable.getClazz() == null || embeddable.getClazz().isEmpty()) {
        embeddable.setClazz(this.getModelerScene().getNextClassName("Embeddable_"));
    }
    setName(embeddable.getClazz());
    setLabel(embeddable.getClazz());
    validateName(null, this.getName());

}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:16,代码来源:EmbeddableWidget.java

示例8: init

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
    public void init() {
        Embeddable embeddable = (Embeddable) this.getBaseElementSpec();
        if (embeddable.getAttributes() == null) {
            embeddable.setAttributes(new EmbeddableAttributes());
//            addNewIdAttribute("id");
//            sortAttributes();
        }
        if (embeddable.getClazz() == null || embeddable.getClazz().isEmpty()) {
            embeddable.setClazz(((JPAModelerScene) this.getModelerScene()).getNextClassName("Embeddable_"));
        }
        setName(embeddable.getClazz());
        setLabel(embeddable.getClazz());

    }
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:16,代码来源:EmbeddableWidget.java

示例9: getMapKeyEmbeddable

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
 * @return the mapKeyEmbeddable
 */
@Override
public Embeddable getMapKeyEmbeddable() {
    return mapKeyEmbeddable;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:8,代码来源:MultiRelationAttribute.java

示例10: setMapKeyEmbeddable

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
 * @param mapKeyEmbeddable the mapKeyEmbeddable to set
 */
@Override
public void setMapKeyEmbeddable(Embeddable mapKeyEmbeddable) {
    resetMapAttributeExceptEmbeddable();
    this.mapKeyEmbeddable = mapKeyEmbeddable;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:9,代码来源:MultiRelationAttribute.java

示例11: EmbeddableSpecAccessor

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private EmbeddableSpecAccessor(Embeddable embeddable) {
    this.embeddable = embeddable;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:4,代码来源:EmbeddableSpecAccessor.java

示例12: getEmbeddable

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
 * @return the embeddable
 */
public Embeddable getEmbeddable() {
    return embeddable;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:7,代码来源:EmbeddableSpecAccessor.java

示例13: EmbeddableGenerator

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
public EmbeddableGenerator(Embeddable parsedEmbeddable, String packageName) {
    super(new ManagedClassDefSnippet(), parsedEmbeddable.getRootElement().getJavaEEVersion());
    this.embeddable = parsedEmbeddable;
    this.rootPackageName = packageName;
    this.packageName = embeddable.getAbsolutePackage(rootPackageName);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:7,代码来源:EmbeddableGenerator.java

示例14: loadAttributes

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private void loadAttributes() {
        ManagedClass attributeClass = null;
        String prefix;
        if(mapKey){
            prefix = "key";
            if (convertContainer instanceof MapKeyHandler) {//ElementCollection,MultiRelationAttribute
                MapKeyHandler elementCollection = (MapKeyHandler) convertContainer;
//                if (elementCollection.getMapKeyAttribute() != null) {//MapKeyType.EXT
//                    if (elementCollection.getMapKeyAttribute() instanceof Embedded) {
//                        attributeClass = ((Embedded) elementCollection.getMapKeyAttribute()).getConnectedClass();
//                    }
//                } else 
                if (elementCollection.getMapKeyEmbeddable() != null) {//MapKeyType.NEW
                    attributeClass = elementCollection.getMapKeyEmbeddable();
                } else if (elementCollection.getMapKeyEntity() != null) {//MapKeyType.NEW
                    attributeClass = elementCollection.getMapKeyEntity();
                }
            } 
        } else {
            prefix = EMPTY;
            if (convertContainer instanceof org.netbeans.jpa.modeler.spec.Entity) {
                attributeClass = (ManagedClass) ((org.netbeans.jpa.modeler.spec.Entity) convertContainer).getSuperclass();
            } else if (convertContainer instanceof Embedded) {
                attributeClass = ((Embedded) convertContainer).getConnectedClass();
            } else if (convertContainer instanceof ElementCollection) {
                attributeClass = ((ElementCollection) convertContainer).getConnectedClass();
            }
        }
        
        attribute_ComboBox.removeAllItems();
        attribute_Label.setEnabled(attributeClass != null);
        attribute_ComboBox.setEnabled(attributeClass != null);
        
        if (attributeClass != null) {
            List<String> items = new ArrayList<>();
            List<Attribute> attributes = attributeClass.getAttributes().getAllAttribute(true);
            items.addAll(attributes
                        .stream()
                        .filter(attr -> attr instanceof Basic)
                        .map(attr -> (Basic)attr)
                        .filter(basic -> basic.getTemporal() == null)
                        .filter(basic -> basic.getEnumerated() == null)
                        .map(Basic::getName)
                        .map(attrName -> prefix.isEmpty() ? attrName : (prefix + '.' + attrName))
                        .collect(toList()));
                items.addAll(attributes
                        .stream()
                        .filter(attr -> attr instanceof ElementCollection)
                        .map(attr -> (ElementCollection)attr)
                        .filter(ec -> ec.getTemporal() == null)
                        .filter(ec -> ec.getEnumerated() == null)
                        .map(ElementCollection::getName)
                        .map(attrName -> prefix.isEmpty() ? attrName : (prefix + '.' + attrName))
                        .collect(toList()));
                
//            if ((attributeClass instanceof org.netbeans.jpa.modeler.spec.Entity) || (attributeClass instanceof MappedSuperclass)) {
              if (attributeClass instanceof Embeddable) {
                items.addAll(attributes
                        .stream()
                        .filter(attr -> attr instanceof Embedded)
                        .map(attr -> (Embedded)attr)
                        .map(emb -> getPaths(prefix, emb, attr -> ((attr instanceof Basic) || (attr instanceof ElementCollection))))
                        .collect(ArrayList<String>::new, ArrayList::addAll, ArrayList::addAll));
            }
            items.stream().forEach(attribute_ComboBox::addItem);
        }
    }
 
开发者ID:jeddict,项目名称:jeddict,代码行数:68,代码来源:OverrideConvertPanel.java

示例15: createBaseElementSpec

import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
public Embeddable createBaseElementSpec() {
    return new Embeddable();
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:5,代码来源:EmbeddableWidget.java


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