From 2e0878d894f821db411c87f2ffff094e9b32b5ee Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 10 Jun 2015 00:58:12 +0200 Subject: [PATCH] Throw an exception from private constructor This is a utility class, it should never be instantiated. Change-Id: Ic2edd90d0cf084a3a38e5a6c068172b9d774799e Signed-off-by: Robert Varga --- .../sal/java/api/generator/GeneratorUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/GeneratorUtil.java b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/GeneratorUtil.java index dae2d33a76..5d1939a523 100644 --- a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/GeneratorUtil.java +++ b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/GeneratorUtil.java @@ -9,7 +9,6 @@ package org.opendaylight.yangtools.sal.java.api.generator; 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; @@ -32,6 +31,7 @@ public final class GeneratorUtil { * It doesn't have the sense to create the instances of this class. */ private GeneratorUtil() { + throw new UnsupportedOperationException(); } /** @@ -46,7 +46,7 @@ public final class GeneratorUtil { * @throws IllegalArgumentException * if genType equals null */ - public static Map createImports(GeneratedType genType) { + public static Map createImports(final GeneratedType genType) { if (genType == null) { throw new IllegalArgumentException("Generated Type cannot be NULL!"); } @@ -178,7 +178,7 @@ public final class GeneratorUtil { *
  • if genTO equals null
  • * */ - 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(); } @@ -201,7 +201,7 @@ public final class GeneratorUtil { * @return map of the package names for all the enclosed types and * recursivelly their enclosed types */ - public static Map createChildImports(GeneratedType genType) { + public static Map createChildImports(final GeneratedType genType) { Map childImports = new LinkedHashMap<>(); List childGeneratedTypes = genType.getEnclosedTypes(); if (!childGeneratedTypes.isEmpty()) { @@ -289,7 +289,7 @@ public final class GeneratorUtil { *
  • then builder + actual type * parameters
  • else only builder
  • */ - private static StringBuilder addActualTypeParameters(StringBuilder builder, final Type type, + private static StringBuilder addActualTypeParameters(final StringBuilder builder, final Type type, final GeneratedType parentGenType, final Map imports) { if (type instanceof ParameterizedType) { final ParameterizedType pType = (ParameterizedType) type; @@ -314,7 +314,7 @@ public final class GeneratorUtil { * @return string with all actual type parameters from pTypes */ private static String getParameters(final GeneratedType parentGenType, final Type[] pTypes, - Map availableImports) { + final Map availableImports) { if (pTypes == null || pTypes.length == 0) { return "?"; } @@ -355,7 +355,7 @@ public final class GeneratorUtil { * @throws IllegalArgumentException * if childTransportObject equals null */ - 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."); } @@ -375,7 +375,7 @@ public final class GeneratorUtil { * @return subset of properties which have read only attribute * set to true */ - public static List resolveReadOnlyPropertiesFromTO(List properties) { + public static List resolveReadOnlyPropertiesFromTO(final List properties) { List readOnlyProperties = new ArrayList(); if (properties != null) { for (final GeneratedProperty property : properties) { @@ -399,7 +399,7 @@ public final class GeneratorUtil { * generated transfer object. In case when extension exists the * method is recursive called. */ - public static List getPropertiesOfAllParents(GeneratedTransferObject genTO) { + public static List getPropertiesOfAllParents(final GeneratedTransferObject genTO) { List propertiesOfAllParents = new ArrayList(); if (genTO.getSuperType() != null) { final List allPropertiesOfTO = genTO.getSuperType().getProperties(); -- 2.36.6