Parent parent = new Parent(); parent.name = "ParentName"; Child child = new Child(); child.name = "ChildName"; parent.child = child; // this will update the id in child childDao.create(child); // this saves the parent with the id of the child parentDao.create(parent);
List<Child> childList = new ArrayList<Child>(); childList.add(new Child()); List<? extends Parent> parentList = childList; parentList.set(0, new Parent()); Child child = childList.get(0); // No! It's not a child! Type safety is broken...
Parent parent = new Parent(); ... Child c1 = new Child(); ... parent.addToChild(c1); session.save(parent);
Parent parent = new Parent(); parent.name = 1; Child child = new Child(); child.name = 2; child.salary = 2000; Parent[] employees = new Parent[] { parent, child }; for (Parent employee : employees) { employee.getEmployeeDetails(); }
Parent parent = new Parent(); ... Child c1 = new Child(); ... c1.setParent(parent); List<Child> children = new ArrayList<Child>(); children.add(c1); parent.setChilds(children); session.save(parent);
Parent parent = new Parent(); Child child1 = new Child(); Parent child2 = new Child(); parent.StaticMethod(); child1.StaticMethod(); child2.StaticMethod();
protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map<Object, Object> context ) { Parent src = source.getParent(); if ( src != null ) { Parent tgt = target.getParent(); if ( tgt == null ) { tgt = new Parent(); tgt.setRelativePath( null ); target.setParent( tgt ); } mergeParent( tgt, src, sourceDominant, context ); } }
public static Parent cloneParent( Parent src ) { if ( src == null ) { return null; } Parent result = new Parent(); result.setArtifactId( src.getArtifactId() ); result.setGroupId( src.getGroupId() ); result.setRelativePath( src.getRelativePath() ); result.setVersion( src.getVersion() ); return result; }
parents.add(new Parent()); Child c = children.get(0);
Parent parent = new Parent(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
public void parent(NamedValue... keyValuePairs) { Parent parent = new Parent(); parent = NamedValueProcessor.namedToObject(parent, keyValuePairs); model.setParent(parent); }
public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attrs) throws InstantiationException, IllegalAccessException { Parent node; if (value != null) { node = parse(value); if (node == null) { throw new NodeValueParseException(this, value); } } else { node = new Parent(); } return node; }
public static Parent parse(final Object value) { assert value != null; if (value instanceof String) { Parent node = new Parent(); String[] items = ((String) value).split(":"); switch (items.length) { case 3: node.setGroupId(items[0]); node.setArtifactId(items[1]); node.setVersion(items[2]); return node; } } return null; } }
Parent parent = new Parent(); InputLocation _location; _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergeParent(new Parent()); } }
Parent parent = new Parent(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
private Parent parent() { if (match(Kind.PARENT) == null) return null; if (match(Kind.COLON) == null) { log.severe("Expected ':' after 'inherits'"); return null; } Id parentId = id(true); if (parentId == null) { log.severe("Expected complete artifact identifier in 'parent' clause"); return null; } String relativePath = "../pom.atom"; if (match(Token.Kind.COLON) != null) { relativePath = relativePath(); if (relativePath == null) { return null; } } Parent parent = new Parent(); parent.setGroupId(parentId.getGroup()); parent.setArtifactId(parentId.getArtifact()); parent.setVersion(parentId.getVersion()); parent.setRelativePath(relativePath); return parent; }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergeParent(new Parent()); } }
Parent p = new Parent(); p.setGroupId("org.codehaus.griffon"); p.setArtifactId("application-master-pom"); p.setVersion("1.0.0"); MavenFacet mavenFacet = getFaceted().getFacet(MavenFacet.class); Model model = mavenFacet.getModel(); model.setParent(p); mavenFacet.setModel(model);
Parent parent = new Parent(); parent = parentDomainService.save(parent); parent.setChildren(Lists.newArrayList(new Child(), new Child())); for (Child child: parent.getChildren()) { child.setParentId(parent.getId()); } childDomainService.save(parent.getChildren());