org.apache.isis.core.progmodel.facets.value
Class ValueSemanticsProviderAbstractTemporal<T>

java.lang.Object
  extended by org.apache.isis.core.metamodel.facetapi.FacetAbstract
      extended by org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract<T>
          extended by org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal<T>
All Implemented Interfaces:
org.apache.isis.applib.adapters.DefaultsProvider<T>, org.apache.isis.applib.adapters.EncoderDecoder<T>, org.apache.isis.applib.adapters.Parser<T>, org.apache.isis.applib.adapters.ValueSemanticsProvider<T>, org.apache.isis.core.metamodel.facetapi.Facet, DateValueFacet
Direct Known Subclasses:
DateAndTimeValueSemanticsProviderAbstract, DateValueSemanticsProviderAbstract, TimeStampValueSemanticsProviderAbstract, TimeValueSemanticsProviderAbstract

public abstract class ValueSemanticsProviderAbstractTemporal<T>
extends ValueSemanticsProviderAndFacetAbstract<T>
implements DateValueFacet


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.isis.core.metamodel.facetapi.FacetAbstract
org.apache.isis.core.metamodel.facetapi.FacetAbstract.Disabling, org.apache.isis.core.metamodel.facetapi.FacetAbstract.Hiding, org.apache.isis.core.metamodel.facetapi.FacetAbstract.Validating
 
Field Summary
protected  DateFormat format
           
static String FORMAT_KEY_PREFIX
           
protected static String ISO_ENCODING_FORMAT
           
 
Fields inherited from interface org.apache.isis.core.progmodel.facets.value.date.DateValueFacet
DATE, DATE_AND_TIME, DATE_ONLY, PRECISION, TIME, TIME_ONLY, TIMESTAMP
 
Constructor Summary
ValueSemanticsProviderAbstractTemporal(String propertyType, Class<? extends org.apache.isis.core.metamodel.facetapi.Facet> facetType, org.apache.isis.core.metamodel.facetapi.FacetHolder holder, Class<T> adaptedClass, int typicalLength, boolean immutable, boolean equalByContent, T defaultValue, org.apache.isis.core.commons.config.IsisConfiguration configuration, ValueSemanticsProviderContext context)
          Allows the specific facet subclass to be specified (rather than use type().
ValueSemanticsProviderAbstractTemporal(String propertyName, org.apache.isis.core.metamodel.facetapi.FacetHolder holder, Class<T> adaptedClass, int typicalLength, boolean immutable, boolean equalByContent, T defaultValue, org.apache.isis.core.commons.config.IsisConfiguration configuration, ValueSemanticsProviderContext context)
          Uses type() as the facet type.
 
Method Summary
protected abstract  T add(T original, int years, int months, int days, int hours, int minutes)
           
protected  void buildDefaultFormatIfRequired()
           
protected  void buildFormat(String configuredFormat)
           
protected  void clearFields(Calendar cal)
           
protected  void configureFormats()
           
protected static DateFormat createDateFormat(String mask)
           
 org.apache.isis.core.metamodel.adapter.ObjectAdapter createValue(Date date)
           
protected abstract  Date dateValue(Object value)
           
 Date dateValue(org.apache.isis.core.metamodel.adapter.ObjectAdapter object)
           
protected abstract  String defaultFormat()
           
protected  String doEncode(Object object)
          Hook method to perform the actual encoding.
protected  T doParse(Object context, String entry)
           
protected  T doRestore(String data)
          Hook method to perform the actual restoring.
protected  DateFormat format(org.apache.isis.applib.profiles.Localization localization)
           
protected abstract  Map<String,DateFormat> formats()
           
abstract  int getLevel()
          For subclasses to implement.
protected  boolean ignoreTimeZone()
           
protected  boolean isEmpty()
           
protected abstract  T now()
           
protected abstract  T setDate(Date date)
           
static void setFormat(String propertyType, String formatStr)
          Introduced to allow BDD tests to provide a different format string "mid-flight".
 void setMask(String mask)
           
 String titleString(Object value, org.apache.isis.applib.profiles.Localization localization)
          Return a string representation of aforesaid object.
 String titleStringWithMask(Object value, String usingMask)
           
static Class<? extends org.apache.isis.core.metamodel.facetapi.Facet> type()
          The facet type, used if not specified explicitly in the constructor.
 
Methods inherited from class org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract
alwaysReplace, createAdapter, determineNumberFormat, displayTitleOf, displayTitleOf, fromEncodedString, getAdaptedClass, getAdapterMap, getAuthenticationSessionProvider, getClock, getConfiguration, getContext, getDefaultsProvider, getDefaultValue, getDependencyInjector, getEncoderDecoder, getParser, getSpecification, getSpecificationLookup, isEqualByContent, isImmutable, parseableTitleOf, parseTextEntry, titleString, toEncodedString, typicalLength
 
Methods inherited from class org.apache.isis.core.metamodel.facetapi.FacetAbstract
facetType, getFacetHolder, getIdentified, getUnderlyingFacet, isDerived, isNoop, setFacetHolder, setUnderlyingFacet, toString, toStringValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.isis.core.metamodel.facetapi.Facet
alwaysReplace, facetType, getFacetHolder, getUnderlyingFacet, isDerived, isNoop, setFacetHolder, setUnderlyingFacet
 

Field Detail

ISO_ENCODING_FORMAT

protected static final String ISO_ENCODING_FORMAT
See Also:
Constant Field Values

FORMAT_KEY_PREFIX

public static final String FORMAT_KEY_PREFIX
See Also:
Constant Field Values

format

protected DateFormat format
Constructor Detail

ValueSemanticsProviderAbstractTemporal

public ValueSemanticsProviderAbstractTemporal(String propertyName,
                                              org.apache.isis.core.metamodel.facetapi.FacetHolder holder,
                                              Class<T> adaptedClass,
                                              int typicalLength,
                                              boolean immutable,
                                              boolean equalByContent,
                                              T defaultValue,
                                              org.apache.isis.core.commons.config.IsisConfiguration configuration,
                                              ValueSemanticsProviderContext context)
Uses type() as the facet type.


ValueSemanticsProviderAbstractTemporal

public ValueSemanticsProviderAbstractTemporal(String propertyType,
                                              Class<? extends org.apache.isis.core.metamodel.facetapi.Facet> facetType,
                                              org.apache.isis.core.metamodel.facetapi.FacetHolder holder,
                                              Class<T> adaptedClass,
                                              int typicalLength,
                                              boolean immutable,
                                              boolean equalByContent,
                                              T defaultValue,
                                              org.apache.isis.core.commons.config.IsisConfiguration configuration,
                                              ValueSemanticsProviderContext context)
Allows the specific facet subclass to be specified (rather than use type().

Method Detail

setFormat

public static void setFormat(String propertyType,
                             String formatStr)
Introduced to allow BDD tests to provide a different format string "mid-flight".


type

public static Class<? extends org.apache.isis.core.metamodel.facetapi.Facet> type()
The facet type, used if not specified explicitly in the constructor.


createDateFormat

protected static DateFormat createDateFormat(String mask)

configureFormats

protected void configureFormats()

buildDefaultFormatIfRequired

protected void buildDefaultFormatIfRequired()

buildFormat

protected void buildFormat(String configuredFormat)

doParse

protected T doParse(Object context,
                    String entry)
Specified by:
doParse in class ValueSemanticsProviderAndFacetAbstract<T>
Parameters:
context - - the underlying object, or null.
entry - - the proposed new object, as a string representation to be parsed

titleString

public String titleString(Object value,
                          org.apache.isis.applib.profiles.Localization localization)
Description copied from class: ValueSemanticsProviderAndFacetAbstract
Return a string representation of aforesaid object.

Specified by:
titleString in class ValueSemanticsProviderAndFacetAbstract<T>

format

protected DateFormat format(org.apache.isis.applib.profiles.Localization localization)

titleStringWithMask

public String titleStringWithMask(Object value,
                                  String usingMask)
Specified by:
titleStringWithMask in class ValueSemanticsProviderAndFacetAbstract<T>

doEncode

protected String doEncode(Object object)
Description copied from class: ValueSemanticsProviderAndFacetAbstract
Hook method to perform the actual encoding.

Specified by:
doEncode in class ValueSemanticsProviderAndFacetAbstract<T>

doRestore

protected T doRestore(String data)
Description copied from class: ValueSemanticsProviderAndFacetAbstract
Hook method to perform the actual restoring.

Specified by:
doRestore in class ValueSemanticsProviderAndFacetAbstract<T>

dateValue

public final Date dateValue(org.apache.isis.core.metamodel.adapter.ObjectAdapter object)
Specified by:
dateValue in interface DateValueFacet

createValue

public final org.apache.isis.core.metamodel.adapter.ObjectAdapter createValue(Date date)
Specified by:
createValue in interface DateValueFacet

getLevel

public abstract int getLevel()
For subclasses to implement.

Specified by:
getLevel in interface DateValueFacet

add

protected abstract T add(T original,
                         int years,
                         int months,
                         int days,
                         int hours,
                         int minutes)

clearFields

protected void clearFields(Calendar cal)

dateValue

protected abstract Date dateValue(Object value)

defaultFormat

protected abstract String defaultFormat()

formats

protected abstract Map<String,DateFormat> formats()

ignoreTimeZone

protected boolean ignoreTimeZone()

now

protected abstract T now()

setDate

protected abstract T setDate(Date date)

setMask

public void setMask(String mask)

isEmpty

protected boolean isEmpty()


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.