-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #1213 added example of rowbuilder interface * #1213 Added extra functionality to row builder * #1213 resolved issue with fake table * #1213 resolved issue with fake table * #1213 resolved issue with InstrumentsProviderTest failing due to interface change. * #1213 Updated EasyCLA --------- Co-authored-by: chris <[email protected]>
- Loading branch information
1 parent
4236412
commit 508676f
Showing
16 changed files
with
298 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
vuu/src/main/scala/org/finos/vuu/core/row/InMemMapRowBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.finos.vuu.core.row | ||
import org.finos.vuu.core.table.{Column, RowData, RowWithData} | ||
|
||
import scala.collection.mutable | ||
|
||
class InMemMapRowBuilder extends RowBuilder { | ||
|
||
private val mutableMap = new mutable.HashMap[String, Any]() | ||
private var key: String = null | ||
override def setLong(column: Column, v: Long): RowBuilder = { | ||
mutableMap.put(column.name, v) | ||
this | ||
} | ||
|
||
override def setDouble(column: Column, v: Double): RowBuilder = { | ||
mutableMap.put(column.name, v) | ||
this | ||
} | ||
|
||
override def setInt(column: Column, v: Int): RowBuilder = { | ||
mutableMap.put(column.name, v) | ||
this | ||
} | ||
|
||
override def setString(column: Column, v: String): RowBuilder = { | ||
mutableMap.put(column.name, v) | ||
this | ||
} | ||
|
||
override def setBoolean(column: Column, v: Boolean): RowBuilder = { | ||
mutableMap.put(column.name, v) | ||
this | ||
} | ||
override def setKey(key: String): RowBuilder = { | ||
this.key = key | ||
this | ||
} | ||
override def asRow: RowData = { | ||
if(key == null){ | ||
throw new RuntimeException("Key has not been set, this is likely a coding error.") | ||
} | ||
val immMap = mutableMap.toMap | ||
val rowData = RowWithData(key, immMap) | ||
mutableMap.clear() | ||
key = null | ||
rowData | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
vuu/src/main/scala/org/finos/vuu/core/row/RowBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.finos.vuu.core.row | ||
|
||
import org.finos.vuu.core.table.{Column, RowData} | ||
|
||
trait RowBuilder { | ||
def setKey(key: String): RowBuilder | ||
def setLong(column: Column, v: Long): RowBuilder | ||
def setDouble(column: Column, v: Double): RowBuilder | ||
def setInt(column: Column, v: Int): RowBuilder | ||
def setString(column: Column, v: String): RowBuilder | ||
def setBoolean(column: Column, v: Boolean): RowBuilder | ||
/** | ||
* this metyhod effectively resets the builder, emptying its existing contents to begin again. | ||
* @return row with data set | ||
*/ | ||
def asRow: RowData | ||
} | ||
|
||
object NoRowBuilder extends RowBuilder{ | ||
override def setKey(key: String): RowBuilder = ??? | ||
override def setLong(column: Column, v: Long): RowBuilder = ??? | ||
override def setDouble(column: Column, v: Double): RowBuilder = ??? | ||
override def setInt(column: Column, v: Int): RowBuilder = ??? | ||
override def setString(column: Column, v: String): RowBuilder = ??? | ||
override def setBoolean(column: Column, v: Boolean): RowBuilder = ??? | ||
/** | ||
* this metyhod effectively resets the builder, emptying its existing contents to begin again. | ||
* | ||
* @return row with data set | ||
*/ | ||
override def asRow: RowData = ??? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.