summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
e2cd558)
Java 8 introduced this method, which bypasses array cloning done
by getParameterTypes(), making it more efficient. Take advantage
of it.
Change-Id: I130a58c8ca667e57ae29c99abdd8066d8ca7dbd7
JIRA: MDSAL-398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
final RpcInvocationStrategy rpc = rpcNames.get(method);
if (rpc != null) {
final RpcInvocationStrategy rpc = rpcNames.get(method);
if (rpc != null) {
- if (method.getParameterTypes().length == 0) {
+ if (method.getParameterCount() == 0) {
return rpc.invokeEmpty();
}
if (args.length != 1) {
return rpc.invokeEmpty();
}
if (args.length != 1) {
private static boolean isObjectMethod(final Method method) {
switch (method.getName()) {
case "toString":
private static boolean isObjectMethod(final Method method) {
switch (method.getName()) {
case "toString":
- return method.getReturnType().equals(String.class) && method.getParameterTypes().length == 0;
+ return method.getReturnType().equals(String.class) && method.getParameterCount() == 0;
- return method.getReturnType().equals(int.class) && method.getParameterTypes().length == 0;
+ return method.getReturnType().equals(int.class) && method.getParameterCount() == 0;
- return method.getReturnType().equals(boolean.class) && method.getParameterTypes().length == 1 && method
+ return method.getReturnType().equals(boolean.class) && method.getParameterCount() == 1 && method
.getParameterTypes()[0] == Object.class;
default:
return false;
.getParameterTypes()[0] == Object.class;
default:
return false;
* Processes a property defined on the DataStoreProperties interface.
*/
@SuppressWarnings("checkstyle:IllegalCatch")
* Processes a property defined on the DataStoreProperties interface.
*/
@SuppressWarnings("checkstyle:IllegalCatch")
- private static void processDataStoreProperty(final String name, final Class<?> propertyType, Method readMethod) {
+ private static void processDataStoreProperty(final String name, final Class<?> propertyType,
+ final Method readMethod) {
Preconditions.checkArgument(BUILDER_SETTERS.containsKey(name), String.format(
"DataStoreProperties property \"%s\" does not have corresponding setter in DatastoreContext.Builder",
name));
Preconditions.checkArgument(BUILDER_SETTERS.containsKey(name), String.format(
"DataStoreProperties property \"%s\" does not have corresponding setter in DatastoreContext.Builder",
name));
// constructors but the one we want has the bean ConstructorProperties annotation.
for (final Constructor<?> ctor: propertyType.getConstructors()) {
final ConstructorProperties ctorPropsAnnotation = ctor.getAnnotation(ConstructorProperties.class);
// constructors but the one we want has the bean ConstructorProperties annotation.
for (final Constructor<?> ctor: propertyType.getConstructors()) {
final ConstructorProperties ctorPropsAnnotation = ctor.getAnnotation(ConstructorProperties.class);
- if (ctor.getParameterTypes().length == 1 && ctorPropsAnnotation != null) {
+ if (ctor.getParameterCount() == 1 && ctorPropsAnnotation != null) {
findYangTypeGetter(propertyType, ctorPropsAnnotation.value()[0]);
CONSTRUCTORS.put(propertyType, ctor);
break;
findYangTypeGetter(propertyType, ctorPropsAnnotation.value()[0]);
CONSTRUCTORS.put(propertyType, ctor);
break;