Make VintfObject::Builder a template.
... so it can be used in VintfObjectRecovery too.
Test: TH
Bug: 206888109
Change-Id: I5a4eae4c552851a56a2b9b833f0c92f6429f40a9
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 7b7d8e2..c9460a0 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -1243,26 +1243,30 @@
}
// make_unique does not work because VintfObject constructor is private.
-VintfObject::Builder::Builder() : mObject(std::unique_ptr<VintfObject>(new VintfObject())) {}
+VintfObject::Builder::Builder()
+ : VintfObjectBuilder(std::unique_ptr<VintfObject>(new VintfObject())) {}
-VintfObject::Builder& VintfObject::Builder::setFileSystem(std::unique_ptr<FileSystem>&& e) {
+namespace details {
+
+VintfObjectBuilder::~VintfObjectBuilder() {}
+
+VintfObjectBuilder& VintfObjectBuilder::setFileSystem(std::unique_ptr<FileSystem>&& e) {
mObject->mFileSystem = std::move(e);
return *this;
}
-VintfObject::Builder& VintfObject::Builder::setRuntimeInfoFactory(
+VintfObjectBuilder& VintfObjectBuilder::setRuntimeInfoFactory(
std::unique_ptr<ObjectFactory<RuntimeInfo>>&& e) {
mObject->mRuntimeInfoFactory = std::move(e);
return *this;
}
-VintfObject::Builder& VintfObject::Builder::setPropertyFetcher(
- std::unique_ptr<PropertyFetcher>&& e) {
+VintfObjectBuilder& VintfObjectBuilder::setPropertyFetcher(std::unique_ptr<PropertyFetcher>&& e) {
mObject->mPropertyFetcher = std::move(e);
return *this;
}
-std::unique_ptr<VintfObject> VintfObject::Builder::build() {
+std::unique_ptr<VintfObject> VintfObjectBuilder::buildInternal() {
if (!mObject->mFileSystem) mObject->mFileSystem = createDefaultFileSystem();
if (!mObject->mRuntimeInfoFactory)
mObject->mRuntimeInfoFactory = std::make_unique<ObjectFactory<RuntimeInfo>>();
@@ -1270,5 +1274,7 @@
return std::move(mObject);
}
+} // namespace details
+
} // namespace vintf
} // namespace android