biweekly.io.json
Class JCalValue

java.lang.Object
  extended by biweekly.io.json.JCalValue

public class JCalValue
extends Object

Holds the value of a jCal property.

Author:
Michael Angstadt

Constructor Summary
JCalValue(JsonValue... values)
          Creates a new jCal value.
JCalValue(List<JsonValue> values)
          Creates a new jCal value.
 
Method Summary
 List<String> asMulti()
          Parses this jCal value as a multi-valued property value.
 ListMultimap<String,String> asObject()
          Parses this jCal value as an object property value.
 String asSingle()
          Parses this jCal value as a single-valued property value.
 List<List<String>> asStructured()
          Parses this jCal value as a structured property value.
 List<JsonValue> getValues()
          Gets the raw JSON values.
static JCalValue multi(List<?> values)
          Creates a multi-valued value.
static JCalValue multi(Object... values)
          Creates a multi-valued value.
static JCalValue object(ListMultimap<String,Object> value)
          Creates an object value.
static JCalValue single(Object value)
          Creates a single-valued value.
static JCalValue structured(List<List<?>> values)
          Creates a structured value.
static JCalValue structured(Object... values)
           Creates a structured value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCalValue

public JCalValue(List<JsonValue> values)
Creates a new jCal value.

Parameters:
values - the values

JCalValue

public JCalValue(JsonValue... values)
Creates a new jCal value.

Parameters:
values - the values
Method Detail

single

public static JCalValue single(Object value)
Creates a single-valued value.

Parameters:
value - the value
Returns:
the jCal value

multi

public static JCalValue multi(Object... values)
Creates a multi-valued value.

Parameters:
values - the values
Returns:
the jCal value

multi

public static JCalValue multi(List<?> values)
Creates a multi-valued value.

Parameters:
values - the values
Returns:
the jCal value

structured

public static JCalValue structured(Object... values)

Creates a structured value.

This method accepts a vararg of Object instances. List objects will be treated as multi-valued components. All other objects. Null values will be treated as empty components.

Parameters:
values - the values
Returns:
the jCal value

structured

public static JCalValue structured(List<List<?>> values)
Creates a structured value.

Parameters:
values - the values
Returns:
the jCal value

object

public static JCalValue object(ListMultimap<String,Object> value)
Creates an object value.

Parameters:
value - the object
Returns:
the jCal value

getValues

public List<JsonValue> getValues()
Gets the raw JSON values. Use one of the "as*" methods to parse the values as one of the standard jCal values.

Returns:
the JSON values

asSingle

public String asSingle()
Parses this jCal value as a single-valued property value.

Returns:
the value or empty string if not found

asStructured

public List<List<String>> asStructured()
Parses this jCal value as a structured property value.

Returns:
the structured values or empty list if not found

asMulti

public List<String> asMulti()
Parses this jCal value as a multi-valued property value.

Returns:
the values or empty list if not found

asObject

public ListMultimap<String,String> asObject()
Parses this jCal value as an object property value.

Returns:
the object or an empty map if not found


Copyright © 2013 Michael Angstadt. All Rights Reserved.