/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
private AttributeIfc lastAttribute;
- public T switchAttribute(AttributeIfc attributeIfc) {
+ @SuppressWarnings("checkstyle:avoidHidingCauseException")
+ public T switchAttribute(final AttributeIfc attributeIfc) {
this.lastAttribute = attributeIfc;
if (attributeIfc instanceof JavaAttribute) {
try {
- if(((JavaAttribute)attributeIfc).getTypeDefinition() instanceof BinaryTypeDefinition) {
+ if (((JavaAttribute) attributeIfc).getTypeDefinition() instanceof BinaryTypeDefinition) {
return caseJavaBinaryAttribute(openType);
- } else if(((JavaAttribute)attributeIfc).isUnion()) {
+ } else if (((JavaAttribute) attributeIfc).isUnion()) {
return caseJavaUnionAttribute(openType);
- } else if(((JavaAttribute)attributeIfc).isIdentityRef()) {
+ } else if (((JavaAttribute) attributeIfc).isIdentityRef()) {
return caseJavaIdentityRefAttribute(openType);
- } else if(((JavaAttribute)attributeIfc).isEnum()) {
+ } else if (((JavaAttribute) attributeIfc).isEnum()) {
return caseJavaEnumAttribute(openType);
} else {
return caseJavaAttribute(openType);
}
- } catch (UnknownOpenTypeException e) {
+ } catch (final UnknownOpenTypeException e) {
throw getIllegalArgumentException(attributeIfc);
}
return lastAttribute;
}
- protected T caseJavaIdentityRefAttribute(OpenType<?> openType) {
+ protected T caseJavaIdentityRefAttribute(final OpenType<?> openType) {
return caseJavaAttribute(openType);
}
- protected T caseJavaUnionAttribute(OpenType<?> openType) {
+ protected T caseJavaUnionAttribute(final OpenType<?> openType) {
return caseJavaAttribute(openType);
}
- protected T caseJavaEnumAttribute(OpenType<?> openType) {
+ protected T caseJavaEnumAttribute(final OpenType<?> openType) {
return caseJavaAttribute(openType);
}
- protected T caseJavaBinaryAttribute(OpenType<?> openType) {
+ protected T caseJavaBinaryAttribute(final OpenType<?> openType) {
return caseJavaAttribute(openType);
}
- private IllegalArgumentException getIllegalArgumentException(AttributeIfc attributeIfc) {
+ private IllegalArgumentException getIllegalArgumentException(final AttributeIfc attributeIfc) {
return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc
+ " with open type:" + attributeIfc.getOpenType());
}
- public final T caseJavaAttribute(OpenType<?> openType) {
+ public final T caseJavaAttribute(final OpenType<?> openType) {
if (openType instanceof SimpleType<?>) {
return caseJavaSimpleAttribute((SimpleType<?>) openType);
} else if (openType instanceof ArrayType<?>) {
private static class UnknownOpenTypeException extends RuntimeException {
private static final long serialVersionUID = 1L;
- public UnknownOpenTypeException(String message) {
+ UnknownOpenTypeException(final String message) {
super(message);
}
}