Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.infinispan.schematic.internal.document
Class JsonReader.DateValueMatcher

    java.lang.Object
      org.infinispan.schematic.internal.document.JsonReader.SimpleValueMatcher
          org.infinispan.schematic.internal.document.JsonReader.DateValueMatcher

All Implemented Interfaces:
  JsonReader.ValueMatcher

Enclosing class:
  JsonReader

    @NotThreadSafe
    public static class JsonReader.DateValueMatcher

extends JsonReader.SimpleValueMatcher

The component that parses a tokenized JSON stream and attempts to evaluate literal values such as dates

Since:
  5.1
Author:
  Randall Hauch (C) 2011 Red Hat Inc.

Field Summary

Fields inherited from class org.infinispan.schematic.internal.document.JsonReader.SimpleValueMatcher
`values`

Constructor Summary
`JsonReader.DateValueMatcher(DocumentValueFactory values)` Create a new matcher that uses the supplied `DocumentValueFactory` instance.

Method Summary
`protected Date` | `evaluateDate(String millisOrIso)`
`protected Date` | `parseDateFromLiteral(String value)` Parse the date represented by the supplied value.
`Object` | `parseValue(String value)` Parse the value given by the supplied string into an appropriate value object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JsonReader.DateValueMatcher

    public JsonReader.DateValueMatcher(DocumentValueFactory values)

  Create a new matcher that uses the supplied `DocumentValueFactory` instance.

  Parameters:
    `values` - the factory for creating value objects; may not be null

Method Detail

### parseValue

    public Object parseValue(String value)

  Parse the value given by the supplied string into an appropriate value object. This method looks for specific patterns of Date strings; if no known pattern is found, it just returns the supplied value.

  Specified by:
    `parseValue` in interface `JsonReader.ValueMatcher`
  Overrides:
    `parseValue` in class `JsonReader.SimpleValueMatcher`
  Parameters:
    `value` - the string representation of the value
  Returns:
    the value

### parseDateFromLiteral

    protected Date parseDateFromLiteral(String value)

  Parse the date represented by the supplied value. This method is called by the `parseValue(String)` method. This method checks the following formats:
  - a string literal date of the form `"yyyy-MM-ddTHH:mm:ss"` where `T` is a literal character
  - a string literal date of the form `"yyyy-MM-ddTHH:mm:ssZ"` where `T` and `Z` are literal characters
  - a string literal date of the form `"yyyy-MM-ddTHH:mm:ssGMT+00:00"` where `T`, and `GMT` are literal characters
  - a string literal date of the form `"/Date(millisOrIso)/"`
  - a string literal date of the form `"\/Date(millisOrIso)\/"`

  Note that this method does not handle the `new Date(...)` or `Date(...)` representations, as that's handled elsewhere.

  Parameters:
    `value` - the string representation of the value; never null and never empty
  Returns:
    the number, or null if the value could not be parsed

### evaluateDate

    protected Date evaluateDate(String millisOrIso)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.