com.ibm.icu.impl.duration.BasicPeriodFormatterService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-client-compiler-deps Show documentation
Show all versions of vaadin-client-compiler-deps Show documentation
Vaadin is a web application framework for Rich Internet Applications (RIA).
Vaadin enables easy development and maintenance of fast and
secure rich web
applications with a stunning look and feel and a wide browser support.
It features a server-side architecture with the majority of the logic
running
on the server. Ajax technology is used at the browser-side to ensure a
rich
and interactive user experience.
/*
******************************************************************************
* Copyright (C) 2007-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
package com.ibm.icu.impl.duration;
import java.util.Collection;
import com.ibm.icu.impl.duration.impl.PeriodFormatterDataService;
import com.ibm.icu.impl.duration.impl.ResourceBasedPeriodFormatterDataService;
/**
* An implementation of PeriodFormatterService that constructs a
* BasicPeriodFormatterFactory.
*/
public class BasicPeriodFormatterService implements PeriodFormatterService {
private static BasicPeriodFormatterService instance;
private PeriodFormatterDataService ds;
/**
* Return the default service instance. This uses the default data service.
*
* @return an BasicPeriodFormatterService
*/
public static BasicPeriodFormatterService getInstance() {
if (instance == null) {
PeriodFormatterDataService ds = ResourceBasedPeriodFormatterDataService
.getInstance();
instance = new BasicPeriodFormatterService(ds);
}
return instance;
}
/**
* Construct a BasicPeriodFormatterService using the given
* PeriodFormatterDataService.
*
* @param ds the data service to use
*/
public BasicPeriodFormatterService(PeriodFormatterDataService ds) {
this.ds = ds;
}
public DurationFormatterFactory newDurationFormatterFactory() {
return new BasicDurationFormatterFactory(this);
}
public PeriodFormatterFactory newPeriodFormatterFactory() {
return new BasicPeriodFormatterFactory(ds);
}
public PeriodBuilderFactory newPeriodBuilderFactory() {
return new BasicPeriodBuilderFactory(ds);
}
public Collection getAvailableLocaleNames() {
return ds.getAvailableLocales();
}
}