com.amazon.carbonado.info
Class OrderedProperty<S extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.info.OrderedProperty<S>
All Implemented Interfaces:
Appender, Serializable

public class OrderedProperty<S extends Storable>
extends Object
implements Serializable, Appender

Represents a property paired with a preferred ordering direction.

Author:
Brian S O'Neill
See Also:
Serialized Form

Method Summary
 void appendTo(Appendable app)
          Append the string representation of this object to the given Appendable.
 OrderedProperty<S> direction(Direction direction)
           
 boolean equals(Object obj)
           
static
<S extends Storable>
OrderedProperty<S>
get(ChainedProperty<S> property, Direction direction)
          Returns a canonical instance.
static
<S extends Storable>
OrderedProperty<S>
get(StorableProperty<S> property, Direction direction)
          Returns a canonical instance.
 ChainedProperty<S> getChainedProperty()
           
 Direction getDirection()
           
 int hashCode()
           
static
<S extends Storable>
OrderedProperty<S>
parse(StorableInfo<S> info, String str)
          Parses an ordering property, which may start with a '+' or '-' to indicate direction.
static
<S extends Storable>
OrderedProperty<S>
parse(StorableInfo<S> info, String str, Direction defaultDirection)
          Parses an ordering property, which may start with a '+' or '-' to indicate direction.
 OrderedProperty<S> reverse()
           
 String toString()
          Returns the chained property in a parseable form.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static <S extends Storable> OrderedProperty<S> get(StorableProperty<S> property,
                                                          Direction direction)
Returns a canonical instance.

Throws:
IllegalArgumentException - if property is null

get

public static <S extends Storable> OrderedProperty<S> get(ChainedProperty<S> property,
                                                          Direction direction)
Returns a canonical instance.

Throws:
IllegalArgumentException - if property is null

parse

public static <S extends Storable> OrderedProperty<S> parse(StorableInfo<S> info,
                                                            String str)
                                                 throws IllegalArgumentException
Parses an ordering property, which may start with a '+' or '-' to indicate direction. Prefix of '~' indicates unspecified direction. If ordering prefix not specified, default direction is ascending.

Parameters:
info - Info for Storable type containing property
str - string to parse
Throws:
IllegalArgumentException - if any required parameter is null or string format is incorrect

parse

public static <S extends Storable> OrderedProperty<S> parse(StorableInfo<S> info,
                                                            String str,
                                                            Direction defaultDirection)
                                                 throws IllegalArgumentException
Parses an ordering property, which may start with a '+' or '-' to indicate direction. Prefix of '~' indicates unspecified direction.

Parameters:
info - Info for Storable type containing property
str - string to parse
defaultDirection - default direction if not specified in string. If null, ascending order is defaulted.
Throws:
IllegalArgumentException - if any required parameter is null or string format is incorrect

getChainedProperty

public ChainedProperty<S> getChainedProperty()

getDirection

public Direction getDirection()

reverse

public OrderedProperty<S> reverse()

direction

public OrderedProperty<S> direction(Direction direction)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Returns the chained property in a parseable form.

Overrides:
toString in class Object

appendTo

public void appendTo(Appendable app)
              throws IOException
Description copied from interface: Appender
Append the string representation of this object to the given Appendable.

Specified by:
appendTo in interface Appender
Parameters:
app - Appendable object to receive string representation
Throws:
IOException - if thrown from given Appendable


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.