org.sonar.api.utils
Class Durations

java.lang.Object
  extended by org.sonar.api.utils.Durations
All Implemented Interfaces:
BatchComponent, ServerComponent

public class Durations
extends Object
implements BatchComponent, ServerComponent

Used through ruby code

Internal.durations

Since:
4.3

Nested Class Summary
static class Durations.DurationFormat
           
 
Constructor Summary
Durations(Settings settings, I18n i18n)
           
 
Method Summary
 Duration create(long minutes)
          Create a Duration object from a number of minutes
 Duration decode(String duration)
          Convert the text to a Duration
Example : decode("9d 10 h") -> Duration.encode("10d2h") (if sonar.technicalDebt.hoursInDay property is set to 8)
 String encode(Duration duration)
          Return the string value of the Duration.
 String format(Locale locale, Duration duration, Durations.DurationFormat format)
          Return the formatted work duration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Durations

public Durations(Settings settings,
                 I18n i18n)
Method Detail

create

public Duration create(long minutes)
Create a Duration object from a number of minutes


decode

public Duration decode(String duration)
Convert the text to a Duration
Example : decode("9d 10 h") -> Duration.encode("10d2h") (if sonar.technicalDebt.hoursInDay property is set to 8)


encode

public String encode(Duration duration)
Return the string value of the Duration.
Example : encode(Duration.encode("9d 10h")) -> "10d2h" (if sonar.technicalDebt.hoursInDay property is set to 8)


format

public String format(Locale locale,
                     Duration duration,
                     Durations.DurationFormat format)
Return the formatted work duration.
Example : format(Locale.FRENCH, Duration.encode("9d 10h"), DurationFormat.SHORT) -> 10j 2h (if sonar.technicalDebt.hoursInDay property is set to 8)



Copyright © 2009–2014 SonarSource. All rights reserved.