本文整理汇总了Java中com.ibm.icu.util.TimeZone.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Java TimeZone.getDefault方法的具体用法?Java TimeZone.getDefault怎么用?Java TimeZone.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.util.TimeZone
的用法示例。
在下文中一共展示了TimeZone.getDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
* Initialize the transient fields, called from the constructor and
* readObject.
*
* @param locale The locale
*/
private void initialize(ULocale locale) {
ICUResourceBundle bundle = (ICUResourceBundle)ICUResourceBundle.getBundleInstance(
ICUData.ICU_ZONE_BASE_NAME, locale);
_zoneStrings = (ICUResourceBundle)bundle.get(ZONE_STRINGS_BUNDLE);
// TODO: Access is synchronized, can we use a non-concurrent map?
_tzNamesMap = new ConcurrentHashMap<String, ZNames>();
_mzNamesMap = new ConcurrentHashMap<String, ZNames>();
_namesFullyLoaded = false;
_namesTrie = new TextTrieMap<NameInfo>(true);
_namesTrieFullyLoaded = false;
// Preload zone strings for the default time zone
TimeZone tz = TimeZone.getDefault();
String tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz);
if (tzCanonicalID != null) {
loadStrings(tzCanonicalID);
}
}
示例2: init
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
* Private method initializing the instance of <code>TimeZoneGenericName</code>.
* This method should be called from a constructor and readObject.
*/
private void init() {
if (_tznames == null) {
_tznames = TimeZoneNames.getInstance(_locale);
}
_genericLocationNamesMap = new ConcurrentHashMap<String, String>();
_genericPartialLocationNamesMap = new ConcurrentHashMap<String, String>();
_gnamesTrie = new TextTrieMap<NameInfo>(true);
_gnamesTrieFullyLoaded = false;
// Preload zone strings for the default time zone
TimeZone tz = TimeZone.getDefault();
String tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz);
if (tzCanonicalID != null) {
loadStrings(tzCanonicalID);
}
}
示例3: execute
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public Object execute( Object[] arguments, IScriptFunctionContext scriptContext )
throws BirtException
{
if ( scriptContext != null )
{
locale = (ULocale) scriptContext
.findProperty( org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE );
timeZone = (TimeZone) scriptContext
.findProperty( org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE );
}
if ( timeZone == null )
{
timeZone = TimeZone.getDefault( );
}
return executor.execute( arguments, scriptContext );
}
示例4: apiSetUp
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
@Before
public void apiSetUp() throws Exception
{
defaultTimeZone = TimeZone.getDefault( );
TimeZone.setDefault( TimeZone.getTimeZone( "GMT" ) );
DataEngineContext context = DataEngineContext.newInstance( DataEngineContext.DIRECT_PRESENTATION,
this.scriptContext,
null,
null,
null );
context.setTmpdir( this.getTempDir( ) );
PlatformConfig cfg = new PlatformConfig();
cfg.setTempDir(this.getTempDir( ));
dataEngine = DataEngine.newDataEngine( cfg, context );
prepareDataSource( );
}
示例5: DateGroupCalculator
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
*
* @param intervalStart
* @param intervalRange
* @throws BirtException
*/
public DateGroupCalculator(Object intervalStart, double intervalRange, ULocale locale, TimeZone timeZone ) throws BirtException
{
super( intervalStart, intervalRange );
range = (int)Math.round( intervalRange );
range = (range == 0 ? 1 : range);
if ( intervalStart != null )
this.intervalStart = DataTypeUtil.toDate( intervalStart );
this.locale = locale == null ? ULocale.getDefault( ):locale;
this.timeZone = timeZone == null ? TimeZone.getDefault( ):timeZone;
Calendar c = Calendar.getInstance( this.locale );
c.setTimeZone( this.timeZone );
c.clear( );
c.set( 1970, 0, 1 );
defaultStart = c.getTime( );
this.dateTimeUtil = new DateTimeUtil( this.locale, this.timeZone );
}
示例6: ExecutionContext
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
* create a new context. Call close to finish using the execution context
*/
public ExecutionContext( EngineTask engineTask )
{
if ( engineTask != null )
{
task = engineTask;
engine = (ReportEngine) task.getEngine( );
log = task.getLogger( );
}
else
{
log = Logger.getLogger( ExecutionContext.class.getName( ) );
}
ulocale = ULocale.getDefault( );
timeZone = TimeZone.getDefault( );
eventHandlerManager = new EventHandlerManager( );
}
示例7: afterPropertiesSet
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
boolean timeZoneSet = false;
TimeZone jvmTimeZone = TimeZone.getDefault();
if(jvmTimeZone != null){
String windowsID = TimeZone.getWindowsID(jvmTimeZone.getID());
if(StringUtils.isNotBlank(windowsID)){
log.info("windows time zone context has been set to '"+windowsID+"'. All dates and times sent to (or recieved from) EWS must use this timezone information.");
this.windowsTimeZoneID = windowsID;
timeZoneSet=true;
}else{
log.warn("No windows time zone mapping for "+jvmTimeZone.getID());
}
}else{
log.warn("jvm timezone is not set, this should never happen");
}
if(!timeZoneSet){
log.warn("Failed to identify a matching time zone scheme. Falling back to UTC.");
TimeZone fallbackTimeZone = TimeZone.getTimeZone(FALLBACK_TIMEZONE_ID);
TimeZone.setDefault(fallbackTimeZone);
this.windowsTimeZoneID = FALLBACK_TIMEZONE_ID;
}
}
示例8: getTimeZone
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
* Get the TimeZone
* @return A copy of the TimeZone associated with this date interval formatter.
* @stable ICU 53
*/
public TimeZone getTimeZone()
{
if ( fDateFormat != null ) {
// Here we clone, like other getters here, but unlike
// DateFormat.getTimeZone() and Calendar.getTimeZone()
// which return the TimeZone from the Calendar's zone variable
return (TimeZone)(fDateFormat.getTimeZone().clone());
}
// If fDateFormat is null (unexpected), return default timezone.
return TimeZone.getDefault();
}
示例9: execute
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public Object execute( Object[] arguments, IScriptFunctionContext scriptContext )
throws BirtException
{
if ( scriptContext != null )
{
Object locale = scriptContext.findProperty(
org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE );
if ( !( locale instanceof ULocale ) )
{
locale = ULocale.getDefault( );
}
if ( threadLocale.get( ) != locale )
{
threadLocale.set( (ULocale) locale );
List<SimpleDateFormat> sdfList = new ArrayList<SimpleDateFormat>( );
sdfList.add(
new SimpleDateFormat( "MMM", threadLocale.get( ) ) );
sdfList.add(
new SimpleDateFormat( "MMMM", threadLocale.get( ) ) );
sdfList.add(
new SimpleDateFormat( "EEE", threadLocale.get( ) ) );
sdfList.add(
new SimpleDateFormat( "EEEE", threadLocale.get( ) ) );
threadSDFArray.set( sdfList );
}
Object timeZone = scriptContext.findProperty(
org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE );
if ( !( timeZone instanceof TimeZone ) )
{
timeZone = TimeZone.getDefault( );
}
if ( threadTimeZone.get( ) != timeZone )
{
threadTimeZone.set( (TimeZone) timeZone );
}
}
return this.executor.execute( arguments, scriptContext );
}
示例10: isTimeZoneValid
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public boolean isTimeZoneValid(){
boolean tzValid = false;
TimeZone tzDefault = TimeZone.getDefault();
if(null != tzDefault && StringUtils.isNotBlank(tzDefault.getID())){
String windowsID = TimeZone.getWindowsID(tzDefault.getID());
tzValid = this.windowsTimeZoneID.equals(windowsID);
}
return tzValid;
}
示例11: DataEngineContext
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
* @param mode
* @param scope
* @param reader
* @param writer
* @throws BirtException
*/
public DataEngineContext( int mode, Scriptable scope,
IDocArchiveReader reader, IDocArchiveWriter writer, ClassLoader classLoader, ScriptContext context )
throws BirtException
{
Object[] params = {
Integer.valueOf( mode ), scope, reader, writer, classLoader
};
logger.entering( DataEngineContext.class.getName( ),
"DataEngineContext", //$NON-NLS-1$
params );
if ( !( mode == MODE_GENERATION
|| mode == MODE_PRESENTATION || mode == DIRECT_PRESENTATION || mode == MODE_UPDATE ) )
throw new DataException( ResourceConstants.RD_INVALID_MODE );
if ( writer == null && mode == MODE_GENERATION )
throw new DataException( ResourceConstants.RD_INVALID_ARCHIVE );
if ( reader == null && mode == MODE_PRESENTATION )
throw new DataException( ResourceConstants.RD_INVALID_ARCHIVE );
if ( reader == null && mode == MODE_UPDATE )
throw new DataException( ResourceConstants.RD_INVALID_ARCHIVE );
this.classLoader = classLoader;
this.mode = mode;
this.scope = scope;
this.reader = reader;
this.writer = writer;
this.cacheOption = CACHE_USE_DEFAULT;
this.scriptContext = context;
this.currentLocale = ULocale.getDefault( );
this.currentTimeZone = TimeZone.getDefault( );
logger.exiting( DataEngineContext.class.getName( ), "DataEngineContext" ); //$NON-NLS-1$
}
示例12: setContext
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public static void setContext( IScriptFunctionContext context )
{
scriptContext = context;
if ( scriptContext != null )
{
timeZone = (TimeZone) scriptContext.findProperty( org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE );
}
if( timeZone == null )
{
timeZone = TimeZone.getDefault( );
}
}
示例13: getTimeZone
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public TimeZone getTimeZone()
{
if ( service != null )
{
IReportContext reportContext = service.getReportContext( );
if ( reportContext != null )
{
return reportContext.getTimeZone( );
}
}
return TimeZone.getDefault( );
}
示例14: getTOCTree
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public ITOCTree getTOCTree( String format, ULocale locale )
{
if ( tocTree == null )
{
return null;
}
return new TOCView( tocTree, report.getReportDesign( ), locale,
TimeZone.getDefault( ) );
}
示例15: initialize
import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public void initialize( IEmitterServices service ) throws EngineException
{
if ( service == null )
{
return;
}
out = EmitterUtil.getOuputStream( service, "report.xls" );
if ( service.getReportEngine( ) != null )
{
this.tempFileDir = service.getReportEngine( ).getConfig( )
.getTempDir( );
}
IReportContext reportContext = service.getReportContext( );
if ( reportContext != null )
{
Locale locale = reportContext.getLocale( );
this.locale = locale == null ? ULocale.getDefault( ) : ULocale
.forLocale( locale );
this.timeZone = reportContext.getTimeZone( );
if ( timeZone == null )
{
timeZone = TimeZone.getDefault( );
}
}
IRenderOption renderOption = service.getRenderOption( );
Object option = renderOption
.getOption( IExcelRenderOption.OPTION_MULTIPLE_SHEET );
if ( option instanceof Boolean )
enableMultipleSheet = (Boolean) option;
this.reportContext = service.getReportContext( );
}