Project

General

Profile

Actions

Architecture #8614

closed

Utility to get all objects from a sealed trait

Added by François ARMAND almost 8 years ago. Updated over 7 years ago.

Status:
Released
Priority:
3
Category:
Architecture - Dependencies
Target version:
Effort required:
Name check:
Fix check:
Regression:

Description

We need all the time to get all objects from a sealed trait when they denote an Algebraic Data Structure (a super enum).

There is this magic macro which works on both Scala 2.10 and 2.11 and do exactly that: https://github.com/mrvisser/sealerate

Just add AT THE END of the hierachy :

  def values: Set[MyTrait] = sealerate.values[MyTrait]

That's all. Values never unsynchonized ever again.

The dependency to add is:

    <!-- Utility to generate all case of a sealed base class -->
    <dependency>
      <groupId>ca.mrvisser</groupId>
      <artifactId>sealerate_${scala-binary-version}</artifactId>
      <version>0.0.4</version>
    </dependency>

And we don't need it before 3.1 because no refactoring in 2.11 (but for ex. the new quicksearch in #8563, or password for Aix in #8593 takes advantage of it)

Actions #1

Updated by François ARMAND almost 8 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Nicolas CHARLES
  • Pull Request set to https://github.com/Normation/rudder-parent-pom/pull/23
Actions #2

Updated by François ARMAND almost 8 years ago

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100
Actions #3

Updated by Alexis Mousset over 7 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 3.1.12 and 3.2.5 which were released today.

Actions

Also available in: Atom PDF