ModeShape Distribution 3.0.0.CR1

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

java.lang.Object
  extended by org.infinispan.schematic.internal.document.JsonReader.SimpleValueMatcher
      extended by 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

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:

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)

ModeShape Distribution 3.0.0.CR1

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