2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.testutils;
10 import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
11 import org.opendaylight.yangtools.concepts.Builder;
14 * Xtend extension method for >> operator support for {@link Builder}s.
16 * <pre>import static extension org.opendaylight.mdsal.binding.testutils
17 * .XtendBuilderExtensions.operator_doubleGreaterThan</pre>
19 * <p>allows to write (in an *.xtend, not *.java):
21 * <pre>new InterfaceBuilder >> [
22 * name = "hello, world"
27 * <pre>(new InterfaceBuilder => [
28 * name = "hello, world"
31 * <p>See also org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow for background.
33 * @author Michael Vorburger
35 public final class XtendBuilderExtensions {
37 private XtendBuilderExtensions() { }
39 public static <P extends Object, T extends Builder<P>> P operator_doubleGreaterThan(
40 final T object, final Procedure1<? super T> block) {
43 return object.build();