All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rythm-swift.unionGlobals.txt Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
@args com.linkedin.pegasus.generator.spec.UnionTemplateSpec union, String path, org.coursera.courier.swift.SwiftSyntax syntax, org.coursera.courier.swift.SwiftyJSON swifty
@import com.linkedin.pegasus.generator.spec.UnionTemplateSpec.Member

@{ String className = ((path == null || path.trim().length() == 0) ? "" : (path + ".")) + syntax.escapeKeyword(union.getClassName()) }

@if (syntax.isEquatable()) {
  public func ==(lhs: @className, rhs: @className) -> Bool {
    switch (lhs, rhs) {
      @for(Member member: union.getMembers()) {
        @{ String unionMemberName = syntax.toUnionMemberName(member.getClassTemplateSpec()) }

        case (let .@(unionMemberName)(lhs), let .@(unionMemberName)(rhs)):
          return lhs == rhs
      }
      case (let .UNKNOWN$(lhs), let .UNKNOWN$(rhs)):
          return JSON(lhs) == JSON(rhs)
      default:
          return false
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy