sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1493759 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
Date Mon, 17 Jun 2013 13:45:11 GMT
Author: desruisseaux
Date: Mon Jun 17 13:45:11 2013
New Revision: 1493759

URL: http://svn.apache.org/r1493759
Log:
Keep trace of cached object which were created with the default locale or timezone.
Those cached objects would need to be cleared on localization changes, if we had listeners
for that purpose.

Added:
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java?rev=1493759&r1=1493758&r2=1493759&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java
[UTF-8] Mon Jun 17 13:45:11 2013
@@ -28,6 +28,7 @@ import org.apache.sis.util.collection.Tr
 import org.apache.sis.util.collection.TableColumn;
 import org.apache.sis.util.collection.TreeTableFormat;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.system.LocalizedStaticObject;
 
 
 /**
@@ -66,8 +67,10 @@ final class TreeTableView implements Tre
 
     /**
      * The {@link TreeTableFormat} to use for the {@link #toString()} method implementation.
-     * Created when first needed.
+     * Created when first needed. Would need to be reset to {@code null} on locale or timezone
+     * changes, but we do not yet have any listener for such information.
      */
+    @LocalizedStaticObject
     private static Format format;
 
     /**

Added: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java?rev=1493759&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
(added)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
[UTF-8] Mon Jun 17 13:45:11 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.system;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+
+/**
+ * Annotates a static object using the {@linkplain java.util.Locale#getDefault() default
locale}
+ * and {@linkplain java.util.TimeZone#getDefault() default timezone} values which existed
at the
+ * object creation time.
+ *
+ * If JDK provided listeners allowing SIS to be notified about locale and timezone changes,
we would
+ * reset the annotated object to {@code null}. However since those listeners do not exist
as of JDK7,
+ * we use this annotation in the main time for identifying the code which would need to be
revisited
+ * if we want to take in account default locale/timezone changes in a future SIS version.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface LocalizedStaticObject {
+}

Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/LocalizedStaticObject.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message