dlp: add a utility conversion function#3028
Conversation
pongad
left a comment
There was a problem hiding this comment.
On the contrary, most things look right :)
|
|
||
| private ColorUtil() {} | ||
|
|
||
| public static final Color convert(java.awt.Color c) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| private ColorUtil() {} | ||
|
|
||
| public static final Color convert(java.awt.Color c) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| import com.google.privacy.dlp.v2beta1.Color; | ||
|
|
||
| public class ColorUtil { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| .setGreen(c.getGreen()) | ||
| .setRed(c.getRed()) | ||
| .build(); | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@garrettjonesgoogle PTAL and lmk if anything else to fix up! |
| Color got = Colors.asDlpColor(java.awt.Color.GREEN); | ||
| Assert.assertEquals(got.getBlue(), 0, 0); | ||
| Assert.assertEquals(got.getGreen(), 255, 0); | ||
| Assert.assertEquals(got.getRed(), 0, 0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| private Colors() {} | ||
|
|
||
| public static final Color asDlpColor(java.awt.Color c) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@garrettjonesgoogle PTAL |
…52.0 (#3028) Co-authored-by: Phong Chuong <147636638+PhongChuong@users.noreply.github.com>
There's a lot about this I'm unsure about, since this is my first commit. So, sorry if a lot is wrong here.
Fixes #2321