Skip to Content.
Sympa Menu

notify-dpml - r1641 - trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1641 - trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl
  • Date: Mon, 24 Jul 2006 09:42:43 +0200

Author: mcconnell
Date: 2006-07-24 09:42:33 +0200 (Mon, 24 Jul 2006)
New Revision: 1641

Modified:

trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
Log:


Modified:
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
===================================================================
---
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
2006-07-24 07:42:09 UTC (rev 1640)
+++
trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl/SimpleClock.java
2006-07-24 07:42:33 UTC (rev 1641)
@@ -34,42 +34,11 @@
public class SimpleClock implements Clock
{
//------------------------------------------------------------------
- // static
- //------------------------------------------------------------------
-
- private static final String DEFAULT_PATTERN = "K:mm a, z";
- private static final Locale DEFAULT_LOCALE = Locale.getDefault();
-
- //------------------------------------------------------------------
- // criteria
- //------------------------------------------------------------------
-
-
- /**
- * Declaration of the context information required by the implementation.
- */
- public interface Context
- {
- /**
- * Return the optional date format as a string.
- * @param format the default value
- * @return the date format value
- */
- public String getFormat( final String format );
-
- /**
- * Return the operational locale.
- * @param locale the default value
- * @return the locale
- */
- public Locale getLocale( final Locale locale );
- }
-
- //------------------------------------------------------------------
// state
//------------------------------------------------------------------

- private final Context m_context;
+ private final String m_format;
+ private final Locale m_locale;

//------------------------------------------------------------------
// constructor
@@ -79,9 +48,10 @@
* Creation of a new instance.
* @param context the initial configuration
*/
- public SimpleClock( final Context context )
+ public SimpleClock( final String format, final Locale locale )
{
- m_context = context;
+ m_format = format;
+ m_locale = locale;
}

//------------------------------------------------------------------
@@ -95,18 +65,8 @@
public String getTimestamp()
{
Date date = new Date();
- DateFormat formatter = getDateFormatter();
+ DateFormat formatter = new SimpleDateFormat( m_format, m_locale );
return formatter.format( date );
}

- //------------------------------------------------------------------
- // implementation
- //------------------------------------------------------------------
-
- private DateFormat getDateFormatter()
- {
- String format = m_context.getFormat( DEFAULT_PATTERN );
- Locale locale = m_context.getLocale( DEFAULT_LOCALE );
- return new SimpleDateFormat( format, locale );
- }
}




  • r1641 - trunk/tutorials/tooling/complex/parts/impl/src/main/org/acme/impl, mcconnell at BerliOS, 07/24/2006

Archive powered by MHonArc 2.6.24.

Top of Page