@Immutable FlowEntity
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / infra / OpenDaylightImmutableStyle.java
1 /*
2  * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.genius.infra;
9
10 import static org.immutables.value.Value.Style.ImplementationVisibility.PRIVATE;
11
12 import java.lang.annotation.ElementType;
13 import java.lang.annotation.Retention;
14 import java.lang.annotation.RetentionPolicy;
15 import java.lang.annotation.Target;
16 import org.immutables.value.Value;
17
18 /**
19  * <a href="http://immutables.org">Immutables.org</a> style meta annotation.
20  *
21  * @author Michael Vorburger.ch
22  */
23 @Target({ElementType.PACKAGE, ElementType.TYPE})
24 @Retention(RetentionPolicy.CLASS) // Make it class retention for incremental compilation
25 @Value.Style(
26         // generate *Builder as public top level type and the *Immutable impl. as private inner class
27         visibility = PRIVATE,
28         // we use setter-like convention instead of Immutables.org default (no set* prefix)
29         // because this is makes it look closer to the YANG binding gen. code, and also
30         // because the Xtend literals can use the nicer to read = instead of set*(..);
31         // the down-side is that in Java chained Builder initialization it's more ugly.
32         init = "set*",
33         // It would be neat to able to use strictBuilder = true, BUT:
34         // a) that prevents generation of from() copy methods, which are quite handy
35         //    (unless https://github.com/immutables/immutables/issues/595 gets implemented)
36         // b) that prevents generation of init/setters for collections, which (as above)
37         //    makes it look closer to the YANG binding gen. code which has this (but not addAll),
38         //    because the Xtend literals can use the nicer to read = instead of addAll*(..)
39         //    (unless https://github.com/immutables/immutables/issues/596 gets implemented)
40         strictBuilder = false)
41 public @interface OpenDaylightImmutableStyle { }
42 // Beware: Changes made here are not active without a restart in Eclipse (would need separate project)