Remove compatibility boolean getter generation, i.e.
'Boolean getFoo()' methods no longer get 'Boolean isFoo()' siblings.
JIRA: MDSAL-659
Change-Id: Ib7111ea600296ce1d55730c1d9c754abf3f4f78b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
final BooleanCont booleanContBinding = (BooleanCont)codecContext
.fromNormalizedNode(res.getKey(), res.getValue()).getValue();
- assertTrue(booleanContBinding.isIsFoo());
+ assertTrue(booleanContBinding.getIsFoo());
}
@Test
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.keyedListNotification;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.opaqueObject;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.rpcResult;
-import static org.opendaylight.mdsal.binding.model.util.Types.BOOLEAN;
import static org.opendaylight.mdsal.binding.model.util.Types.STRING;
import static org.opendaylight.mdsal.binding.model.util.Types.classType;
import static org.opendaylight.mdsal.binding.model.util.Types.listTypeFor;
annotateDeprecatedIfNecessary(node, getMethod);
addComment(getMethod, node);
- if (BOOLEAN.equals(returnType)) {
- // Construct a default 'isFoo()' method for compatibility
- interfaceBuilder.addMethod(BindingMapping.getGetterMethodName(node.getQName().getLocalName(), true))
- .setAccessModifier(AccessModifier.PUBLIC)
- .setDefault(true)
- .setReturnType(BOOLEAN);
- }
-
return getMethod;
}
genType = checkGeneratedType(genTypes, "Bar", pcgPref
+ ".netconf.state.datastores.datastore.locks.lock.type.partial.lock.aug._case.by.choice"); // case
containsMethods(genType, new NameTypePattern("getBar", "Boolean"));
- containsMethods(genType, new NameTypePattern("isBar", "Boolean"));
containsInterface("AugCaseByChoice", genType);
// augment "/nm:netconf-state/nm:datastores/nm:datastore" {
assertNotNull("Generated Interface cannot contain NULL reference for Method Signature Definitions!", methods);
// FIXME: split this into getter/default/static asserts
- assertEquals(20, methods.size());
+ assertEquals(19, methods.size());
Enumeration ianaIfType = null;
for (final MethodSignature method : methods) {
if (method.getName().equals("getType")) {
return «fieldName»;
«ENDIF»
}
- «IF field.returnType == Types.BOOLEAN»
-
- @«DEPRECATED.importedName»(forRemoval = true)
- public final «field.returnType.importedName» «BindingMapping.BOOLEAN_GETTER_PREFIX»«field.name.toFirstUpper»() {
- return «methodName»();
- }
- «ENDIF»
'''
final protected def getterMethodName(GeneratedProperty field) {
import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BINDING_EQUALS_NAME
import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BINDING_HASHCODE_NAME
import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BINDING_TO_STRING_NAME
-import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BOOLEAN_GETTER_PREFIX
import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.DATA_CONTAINER_IMPLEMENTED_INTERFACE_NAME
-import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.GETTER_PREFIX
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects
default :
if (VOID == method.returnType.identifier) {
generateNoopVoidInterfaceMethod(method)
- } else if (method.name.startsWith(BOOLEAN_GETTER_PREFIX)) {
- generateIsAccessorMethod(method)
}
}
}
}
'''
- def private generateIsAccessorMethod(MethodSignature method) '''
- @«DEPRECATED.importedName»(forRemoval = true)
- default «method.returnType.importedName» «method.name»(«method.parameters.generateParameters») {
- return «GETTER_PREFIX»«method.name.substring(BOOLEAN_GETTER_PREFIX.length)»();
- }
- '''
-
def private static accessorJavadoc(MethodSignature method, String orString) {
val reference = method.comment?.referenceDescription
val propReturn = method.propertyNameFromGetter + ", or " + orString + " if it is not present."
CompilationTestUtils.assertContainsMethod(nodesClass, b.getClass(), "getIdBinary");
CompilationTestUtils.assertContainsMethod(nodesClass, pkg + ".Nodes$IdBits", "getIdBits", loader);
CompilationTestUtils.assertContainsMethod(nodesClass, Boolean.class, "getIdBoolean");
- CompilationTestUtils.assertContainsMethod(nodesClass, Boolean.class, "isIdBoolean");
CompilationTestUtils.assertContainsMethod(nodesClass, BigDecimal.class, "getIdDecimal64");
CompilationTestUtils.assertContainsMethod(nodesClass, Empty.class, "getIdEmpty");
CompilationTestUtils.assertContainsMethod(nodesClass, pkg + ".Nodes$IdEnumeration", "getIdEnumeration", loader);
private static final String GET_LEAF1_NAME = "getLeaf1";
private static final String GET_LEAFLIST1_NAME = "getLeafList1";
- private static final String IS_LEAF1_NAME = "isLeaf1";
private static final String GET_LEAF1_TYPE_OBJECT = " Object getLeaf1();";
private static final String GET_LEAF1_TYPE_STRING = " String getLeaf1();";
private static final String GET_LEAFLIST1_STRING = " @Nullable List<String> getLeafList1();";
private static final String GET_LEAFLIST1_DECLARATION = " getLeafList1();";
private static final String GET_LEAF1_DECLARATION = " getLeaf1();";
- private static final String IS_LEAF1_BOOLEAN = " Boolean isLeaf1();";
private static final char CLOSING_METHOD_BRACE = '}';
private static final String TAB_CLOSING_METHOD_BRACE = TAB + CLOSING_METHOD_BRACE;
public void testLeafrefWhichPointsBoolean() throws IOException {
verifyReturnType(UNRESOLVED_GROUPING, GET_LEAF1_NAME, Types.objectType());
verifyReturnType(BOOLEAN_CONT, GET_LEAF1_NAME, Types.BOOLEAN);
- verifyReturnType(BOOLEAN_CONT, IS_LEAF1_NAME, Types.BOOLEAN);
final String unresolvedGrouping = getFileContent(UNRESOLVED_GROUPING);
final String booleanCont = getFileContent(BOOLEAN_CONT);
Method defInst = CompilationTestUtils.assertContainsMethod(bitsExtClass, bitsExtClass, "getDefaultInstance",
String.class);
CompilationTestUtils.assertContainsDefaultMethods(bitsExtClass);
- assertEquals(19, bitsExtClass.getDeclaredMethods().length);
+ assertEquals(12, bitsExtClass.getDeclaredMethods().length);
Constructor<?> expectedConstructor = CompilationTestUtils.assertContainsConstructor(bitsExtClass, Boolean.class,
Boolean.class, Boolean.class, Boolean.class, Boolean.class, Boolean.class, Boolean.class);
*/
public static final @NonNull String SCALAR_TYPE_OBJECT_GET_VALUE_NAME = "getValue";
- /**
- * Prefix for getter methods working on top of {@code boolean}. These are only provided for backwards compatiblity,
- * as {@code boolean} is no longer special.
- */
- @Deprecated(forRemoval = true)
- public static final @NonNull String BOOLEAN_GETTER_PREFIX = "is";
-
/**
* Prefix for normal getter methods.
*/
return getMethodName(name.getLocalName());
}
- @Deprecated(forRemoval = true)
- public static @NonNull String getGetterPrefix(final boolean isBoolean) {
- return isBoolean ? BOOLEAN_GETTER_PREFIX : GETTER_PREFIX;
- }
-
- @Deprecated(forRemoval = true)
- public static @NonNull String getGetterMethodName(final String localName, final boolean isBoolean) {
- return getGetterPrefix(isBoolean) + toFirstUpper(getPropertyName(localName));
- }
-
public static @NonNull String getGetterMethodName(final String localName) {
return GETTER_PREFIX + toFirstUpper(getPropertyName(localName));
}
return GETTER_PREFIX + getGetterSuffix(name);
}
- @Deprecated(forRemoval = true)
- public static @NonNull String getGetterMethodName(final QName name, final boolean isBoolean) {
- return getGetterPrefix(isBoolean) + getGetterSuffix(name);
- }
-
public static boolean isGetterMethodName(final String methodName) {
return methodName.startsWith(GETTER_PREFIX);
}