Skip to content

Commit

Permalink
generate semantic attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
iRevive committed Mar 27, 2024
1 parent baa1c64 commit 03bb112
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ object AttributeConverters {
private object Explicit {
def toJava(key: AttributeKey[_]): JAttributeKey[_] =
key.`type` match {
case AttributeType.String => JAttributeKey.stringKey(key.name)
case AttributeType.Boolean => JAttributeKey.booleanKey(key.name)
case AttributeType.Long => JAttributeKey.longKey(key.name)
case AttributeType.Double => JAttributeKey.doubleKey(key.name)
case AttributeType.StringSeq => JAttributeKey.stringArrayKey(key.name)
case AttributeType.BooleanSeq =>
JAttributeKey.booleanArrayKey(key.name)
case AttributeType.LongSeq => JAttributeKey.longArrayKey(key.name)
case AttributeType.DoubleSeq => JAttributeKey.doubleArrayKey(key.name)
case AttributeType.String => JAttributeKey.stringKey(key.name)
case AttributeType.Boolean => JAttributeKey.booleanKey(key.name)
case AttributeType.Long => JAttributeKey.longKey(key.name)
case AttributeType.Double => JAttributeKey.doubleKey(key.name)
case AttributeType.StringSeq => JAttributeKey.stringArrayKey(key.name)
case AttributeType.BooleanSeq => JAttributeKey.booleanArrayKey(key.name)
case AttributeType.LongSeq => JAttributeKey.longArrayKey(key.name)
case AttributeType.DoubleSeq => JAttributeKey.doubleArrayKey(key.name)
}

final def toJava(attributes: Attributes): JAttributes =
Expand Down Expand Up @@ -141,15 +140,14 @@ object AttributeConverters {

def toScala(key: JAttributeKey[_]): AttributeKey[_] =
key.getType match {
case JAttributeType.STRING => AttributeKey.string(key.getKey)
case JAttributeType.BOOLEAN => AttributeKey.boolean(key.getKey)
case JAttributeType.LONG => AttributeKey.long(key.getKey)
case JAttributeType.DOUBLE => AttributeKey.double(key.getKey)
case JAttributeType.STRING_ARRAY => AttributeKey.stringSeq(key.getKey)
case JAttributeType.BOOLEAN_ARRAY =>
AttributeKey.booleanSeq(key.getKey)
case JAttributeType.LONG_ARRAY => AttributeKey.longSeq(key.getKey)
case JAttributeType.DOUBLE_ARRAY => AttributeKey.doubleSeq(key.getKey)
case JAttributeType.STRING => AttributeKey.string(key.getKey)
case JAttributeType.BOOLEAN => AttributeKey.boolean(key.getKey)
case JAttributeType.LONG => AttributeKey.long(key.getKey)
case JAttributeType.DOUBLE => AttributeKey.double(key.getKey)
case JAttributeType.STRING_ARRAY => AttributeKey.stringSeq(key.getKey)
case JAttributeType.BOOLEAN_ARRAY => AttributeKey.booleanSeq(key.getKey)
case JAttributeType.LONG_ARRAY => AttributeKey.longSeq(key.getKey)
case JAttributeType.DOUBLE_ARRAY => AttributeKey.doubleSeq(key.getKey)
}

def toScala(attributes: JAttributes): Attributes = {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03bb112

Please sign in to comment.