com.bea.p13n.model
Class Comparison

java.lang.Object
  extended by com.bea.p13n.model.Comparison
All Implemented Interfaces
Serializable

public class Comparison
extends Object
implements Serializable

An object representing a comparison between a property and a literal value or property.

This only contains the operator and literal or property value. It is designed to be the child of a PropertyContainer.

See Also
Serialized Form

Nested Class Summary
static class Comparison.Type
          The type of comparison this is: property to literal value, or property to property.
 
Constructor Summary
Comparison(Operator op, Comparison.Type type)
          Constructor for null literal or property ref.
Comparison(Operator op, Object value)
          Constructor.
 
Method Summary
 boolean equals(Object o)
          Determine if another Comparison is equal.
 Object getLiteralValue()
          This will return the literal value, if this is a literal value comparison.
 Operator getOperator()
          Get the operator.
 PropertyRefModel getPropertyValue()
          This will return the property value, if this is a property value comparison.
 Comparison.Type getType()
          Get the comparison type.
 Object getValue()
          Get the comparison value.
 int hashCode()
          Override to implement an equality-aware hash function.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Comparison

public Comparison(Operator op,
                  Object value)
Constructor. This will compute the type based upon the value.

Parameters
op - the operator of this comparison.
value - the PropertyRefModel, literal value, or null.

Comparison

public Comparison(Operator op,
                  Comparison.Type type)
Constructor for null literal or property ref.

Parameters
op - the operator of this comparison.
type - the type of comparison.
Method Detail

getValue

public Object getValue()
Get the comparison value. This will return either a PropertyRefModel, null, or a literal value (String, Boolean, Double, Long, Calendar).


getLiteralValue

public Object getLiteralValue()
This will return the literal value, if this is a literal value comparison. Otherwise it will return null.


getPropertyValue

public PropertyRefModel getPropertyValue()
This will return the property value, if this is a property value comparison. Otherwise it will return null.


getOperator

public Operator getOperator()
Get the operator.


getType

public Comparison.Type getType()
Get the comparison type.


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Determine if another Comparison is equal.

Overrides:
equals in class Object

hashCode

public int hashCode()
Override to implement an equality-aware hash function.

Overrides:
hashCode in class Object


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.