This is a utility class, it should never be instantiated.
Change-Id: Ic2edd90d0cf084a3a38e5a6c068172b9d774799e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
2e0878d894f821db411c87f2ffff094e9b32b5ee)
import static com.google.common.base.Preconditions.checkArgument;
import static org.opendaylight.yangtools.sal.java.api.generator.Constants.COMMA;
import static com.google.common.base.Preconditions.checkArgument;
import static org.opendaylight.yangtools.sal.java.api.generator.Constants.COMMA;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
* It doesn't have the sense to create the instances of this class.
*/
private GeneratorUtil() {
* It doesn't have the sense to create the instances of this class.
*/
private GeneratorUtil() {
+ throw new UnsupportedOperationException();
* @throws IllegalArgumentException
* if <code>genType</code> equals <code>null</code>
*/
* @throws IllegalArgumentException
* if <code>genType</code> equals <code>null</code>
*/
- public static Map<String, String> createImports(GeneratedType genType) {
+ public static Map<String, String> createImports(final GeneratedType genType) {
if (genType == null) {
throw new IllegalArgumentException("Generated Type cannot be NULL!");
}
if (genType == null) {
throw new IllegalArgumentException("Generated Type cannot be NULL!");
}
* <li>if <code>genTO</code> equals <code>null</code></li>
* </ul>
*/
* <li>if <code>genTO</code> equals <code>null</code></li>
* </ul>
*/
- public static boolean isConstantInTO(String constName, GeneratedTransferObject genTO) {
+ public static boolean isConstantInTO(final String constName, final GeneratedTransferObject genTO) {
if (constName == null || genTO == null) {
throw new IllegalArgumentException();
}
if (constName == null || genTO == null) {
throw new IllegalArgumentException();
}
* @return map of the package names for all the enclosed types and
* recursivelly their enclosed types
*/
* @return map of the package names for all the enclosed types and
* recursivelly their enclosed types
*/
- public static Map<String, String> createChildImports(GeneratedType genType) {
+ public static Map<String, String> createChildImports(final GeneratedType genType) {
Map<String, String> childImports = new LinkedHashMap<>();
List<GeneratedType> childGeneratedTypes = genType.getEnclosedTypes();
if (!childGeneratedTypes.isEmpty()) {
Map<String, String> childImports = new LinkedHashMap<>();
List<GeneratedType> childGeneratedTypes = genType.getEnclosedTypes();
if (!childGeneratedTypes.isEmpty()) {
* <li>then <code>builder</code> + actual <code>type</code>
* parameters</li> <li>else only <code>builder</code></li>
*/
* <li>then <code>builder</code> + actual <code>type</code>
* parameters</li> <li>else only <code>builder</code></li>
*/
- private static StringBuilder addActualTypeParameters(StringBuilder builder, final Type type,
+ private static StringBuilder addActualTypeParameters(final StringBuilder builder, final Type type,
final GeneratedType parentGenType, final Map<String, String> imports) {
if (type instanceof ParameterizedType) {
final ParameterizedType pType = (ParameterizedType) type;
final GeneratedType parentGenType, final Map<String, String> imports) {
if (type instanceof ParameterizedType) {
final ParameterizedType pType = (ParameterizedType) type;
* @return string with all actual type parameters from <code>pTypes</code>
*/
private static String getParameters(final GeneratedType parentGenType, final Type[] pTypes,
* @return string with all actual type parameters from <code>pTypes</code>
*/
private static String getParameters(final GeneratedType parentGenType, final Type[] pTypes,
- Map<String, String> availableImports) {
+ final Map<String, String> availableImports) {
if (pTypes == null || pTypes.length == 0) {
return "?";
}
if (pTypes == null || pTypes.length == 0) {
return "?";
}
* @throws IllegalArgumentException
* if <code>childTransportObject</code> equals <code>null</code>
*/
* @throws IllegalArgumentException
* if <code>childTransportObject</code> equals <code>null</code>
*/
- public static GeneratedTransferObject getTopParrentTransportObject(GeneratedTransferObject childTransportObject) {
+ public static GeneratedTransferObject getTopParrentTransportObject(final GeneratedTransferObject childTransportObject) {
if (childTransportObject == null) {
throw new IllegalArgumentException("Parameter childTransportObject can't be null.");
}
if (childTransportObject == null) {
throw new IllegalArgumentException("Parameter childTransportObject can't be null.");
}
* @return subset of <code>properties</code> which have read only attribute
* set to true
*/
* @return subset of <code>properties</code> which have read only attribute
* set to true
*/
- public static List<GeneratedProperty> resolveReadOnlyPropertiesFromTO(List<GeneratedProperty> properties) {
+ public static List<GeneratedProperty> resolveReadOnlyPropertiesFromTO(final List<GeneratedProperty> properties) {
List<GeneratedProperty> readOnlyProperties = new ArrayList<GeneratedProperty>();
if (properties != null) {
for (final GeneratedProperty property : properties) {
List<GeneratedProperty> readOnlyProperties = new ArrayList<GeneratedProperty>();
if (properties != null) {
for (final GeneratedProperty property : properties) {
* generated transfer object. In case when extension exists the
* method is recursive called.
*/
* generated transfer object. In case when extension exists the
* method is recursive called.
*/
- public static List<GeneratedProperty> getPropertiesOfAllParents(GeneratedTransferObject genTO) {
+ public static List<GeneratedProperty> getPropertiesOfAllParents(final GeneratedTransferObject genTO) {
List<GeneratedProperty> propertiesOfAllParents = new ArrayList<GeneratedProperty>();
if (genTO.getSuperType() != null) {
final List<GeneratedProperty> allPropertiesOfTO = genTO.getSuperType().getProperties();
List<GeneratedProperty> propertiesOfAllParents = new ArrayList<GeneratedProperty>();
if (genTO.getSuperType() != null) {
final List<GeneratedProperty> allPropertiesOfTO = genTO.getSuperType().getProperties();