import static com.google.common.base.Preconditions.checkState;
import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.ServiceLoader;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
* May return null if QName is not present.
*/
public static QName findQName(final Class<?> dataType) {
- return CLASS_TO_QNAME.getUnchecked(dataType).orNull();
+ return CLASS_TO_QNAME.getUnchecked(dataType).orElse(null);
}
/**
*
* @param targetMethod
* method to scan
- * @return Optional.absent() if result type could not be get, or return type
+ * @return Optional.empty() if result type could not be get, or return type
* is Void.
*/
@SuppressWarnings("rawtypes")
if (operationResultArgument instanceof Class && !Void.class.equals(operationResultArgument)) {
return Optional.of((Class) operationResultArgument);
}
- return Optional.absent();
+ return Optional.empty();
}
/**
*
* @param targetMethod
* - method to scan
- * @return Optional.absent() if RPC or Action has no input, RPC input type
+ * @return Optional.empty() if RPC or Action has no input, RPC input type
* otherwise.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
return Optional.of(clazz);
}
}
- return Optional.absent();
+ return Optional.empty();
}
/**
private static Optional<Class<? extends Instantiable<?>>> getYangModeledReturnType(final Method method) {
if ("getClass".equals(method.getName()) || !method.getName().startsWith("get")
|| method.getParameterTypes().length > 0) {
- return Optional.absent();
+ return Optional.empty();
}
final Class returnType = method.getReturnType();
&& Instantiable.class.isAssignableFrom((Class) listResult)) {
return Optional.of((Class) listResult);
}
- return Optional.absent();
+ return Optional.empty();
});
} catch (final Exception e) {
/*
LOG.debug("Unable to find YANG modeled return type for {}", method, e);
}
}
- return Optional.absent();
+ return Optional.empty();
}
private static class ClassToQNameLoader extends CacheLoader<Class<?>, Optional<QName>> {
*/
LOG.debug("Unexpected exception during extracting QName for {}", key, e);
}
- return Optional.absent();
+ return Optional.empty();
}
/**