Constants should have capitalized names. Fixes a few sonar warnings.
Change-Id: I600b482a817055784874e91f9cb8c5b06b948302
Signed-off-by: Robert Varga <rovarga@cisco.com>
import org.sonatype.plexus.build.incremental.BuildContext;
public final class CodeGeneratorImpl implements BasicCodeGenerator, BuildContextAware, MavenProjectAware {
- private static final Logger logger = LoggerFactory.getLogger(CodeGeneratorImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CodeGeneratorImpl.class);
private static final String FS = File.separator;
private BuildContext buildContext;
private File projectBaseDir;
// TODO: do not mutate parameters, output of a method is defined by its return value
Set<File> moduleInfoProviders = generateYangModuleInfo(outputBaseDir, module, context, currentProvidersBuilder);
ImmutableSet<String> currentProviders = currentProvidersBuilder.build();
- logger.info("Adding ModuleInfo providers {}", currentProviders);
+ LOG.info("Adding ModuleInfo providers {}", currentProviders);
bindingProviders.addAll(currentProviders);
result.addAll(moduleInfoProviders);
}
File outputBaseDir;
outputBaseDir = new File(DEFAULT_OUTPUT_BASE_DIR_PATH);
setOutputBaseDirAsSourceFolder(outputBaseDir, mavenProject);
- logger.debug("Adding " + outputBaseDir.getPath() + " as compile source root");
+ LOG.debug("Adding " + outputBaseDir.getPath() + " as compile source root");
return outputBaseDir;
}
bw.write(source);
}
} catch (Exception e) {
- logger.error("Could not write file: {}",file,e);
+ LOG.error("Could not write file: {}",file,e);
}
} catch (Exception e) {
- logger.error("Could not create file: {}",file,e);
+ LOG.error("Could not create file: {}",file,e);
}
return file;
}
private static final Pattern ROOT_PACKAGE_PATTERN = Pattern.compile(ROOT_PACKAGE_PATTERN_STRING);
private static final Logger LOG = LoggerFactory.getLogger(BindingReflections.class);
- private static final LoadingCache<Class<?>, Optional<QName>> classToQName = CacheBuilder.newBuilder() //
+ private static final LoadingCache<Class<?>, Optional<QName>> CLASS_TO_QNAME = CacheBuilder.newBuilder() //
.weakKeys() //
.expireAfterAccess(EXPIRATION_TIME, TimeUnit.SECONDS) //
.build(new ClassToQNameLoader());
* May return null if QName is not present.
*/
public static final QName findQName(final Class<?> dataType) {
- return classToQName.getUnchecked(dataType).orNull();
+ return CLASS_TO_QNAME.getUnchecked(dataType).orNull();
}
/**
abstract class AbstractIntegerStringCodec<N extends Number & Comparable<N>, T extends TypeDefinition<T>> extends TypeDefinitionAwareCodec<N, T>{
- private static final Pattern intPattern = Pattern.compile("[+-]?[1-9][0-9]*$");
- private static final Pattern hexPattern = Pattern.compile("[+-]?0[xX][0-9a-fA-F]+");
- private static final Pattern octalPattern = Pattern.compile("[+-]?0[1-7][0-7]*$");
+ private static final Pattern INT_PATTERN = Pattern.compile("[+-]?[1-9][0-9]*$");
+ private static final Pattern HEX_PATTERN = Pattern.compile("[+-]?0[xX][0-9a-fA-F]+");
+ private static final Pattern OCT_PATTERN = Pattern.compile("[+-]?0[1-7][0-7]*$");
// For up to two characters, this is very fast
private static final CharMatcher X_MATCHER = CharMatcher.anyOf("xX");
return 10;
}
- final Matcher intMatcher = intPattern.matcher(integer);
+ final Matcher intMatcher = INT_PATTERN.matcher(integer);
if (intMatcher.matches()) {
return 10;
}
- final Matcher hexMatcher = hexPattern.matcher(integer);
+ final Matcher hexMatcher = HEX_PATTERN.matcher(integer);
if (hexMatcher.matches()) {
return 16;
}
- final Matcher octMatcher = octalPattern.matcher(integer);
+ final Matcher octMatcher = OCT_PATTERN.matcher(integer);
if (octMatcher.matches()) {
return 8;
}
*/
final class OperationStack {
- private static final Logger logger = LoggerFactory.getLogger(OperationStack.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OperationStack.class);
private static final QName OPERATION_NAME = new QName(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), "operation");
private final Deque<ModifyAction> operations = new LinkedList<>();
private void addOperation(ModifyAction operation) {
// Add check for permitted operation
operations.add(operation);
- logger.trace("Operation added {}, {}", operation, this);
+ LOG.trace("Operation added {}, {}", operation, this);
}
public ModifyAction getCurrentOperation() {
operations.peekLast(), operation);
ModifyAction removed = operations.removeLast();
- logger.trace("Operation removed {}, {}", removed, this);
+ LOG.trace("Operation removed {}, {}", removed, this);
}
@Override
static final String SUPPORTED_YANG_VERSION = "1";
private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings();
- private static final Pattern identifierPattern = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
- private static final Pattern prefixedIdentifierPattern = Pattern.compile("(.+):(.+)");
+ private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
+ private static final Pattern PREFIX_IDENTIFIER_PATTERN = Pattern.compile("(.+):(.+)");
/**
* It isn't desirable to create instance of this class.
}
static void checkIdentifierInternal(final ParseTree statement, final String name) {
- if (!identifierPattern.matcher(name).matches()) {
+ if (!IDENTIFIER_PATTERN.matcher(name).matches()) {
String message = ValidationUtil.f("%s statement identifier:%s is not in required format:%s",
- ValidationUtil.getSimpleStatementName(statement.getClass()), name, identifierPattern.toString());
+ ValidationUtil.getSimpleStatementName(statement.getClass()), name, IDENTIFIER_PATTERN.toString());
String parent = ValidationUtil.getRootParentName(statement);
message = parent.equals(name) ? message : ValidationUtil.f("(In (sub)module:%s) %s", parent, message);
}
private static void checkPrefixedIdentifierInternal(final ParseTree statement, final String id) {
- Matcher matcher = prefixedIdentifierPattern.matcher(id);
+ Matcher matcher = PREFIX_IDENTIFIER_PATTERN.matcher(id);
if (matcher.matches()) {
try {