View Javadoc

1   /*
2    * PosibleValueImpl.java
3    * Created on 7 Июнь 2006 г., 0:50
4    */
5   
6   package org.weda.property.impl;
7   
8   import org.apache.commons.lang.ObjectUtils;
9   import org.weda.enhance.InjectInplaceMessage;
10  import org.weda.message.Messages;
11  import org.weda.message.impl.InplaceMessage;
12  import org.weda.property.PosibleValue;
13  import org.weda.property.PropertyDescriptor;
14  
15  /**
16   *
17   * @author Mikhail Titov
18   */
19  public class PosibleValueImpl implements PosibleValue {
20      private Object value;
21      private PropertyDescriptor propertyDescriptor;
22      @InjectInplaceMessage private String alias;
23      
24  //    public PosibleValueImpl() {}
25      
26      public PosibleValueImpl(Object value, PropertyDescriptor propertyDescriptor)
27      {
28          this.value = value;
29          this.propertyDescriptor = propertyDescriptor;
30      }
31      
32      public PosibleValueImpl(
33              Object value, String alias, PropertyDescriptor propertyDescriptor)
34      {
35          this(value, propertyDescriptor);
36          this.alias = alias;
37      }
38  
39      public String getAlias() {
40          return alias;
41      }
42  
43      public Object getValue() {
44          return value;
45      }
46  
47      public void setValue(Object value) {
48          this.value = value;
49      }
50      
51      public boolean equals(Object obj){
52          if (obj instanceof PosibleValueImpl){
53              PosibleValue o = (PosibleValue)obj;
54              return 
55                  ObjectUtils.equals(value, o.getValue())
56                  && ObjectUtils.equals(alias, o.getAlias())
57                  && propertyDescriptor.equals(o.getPropertyDescriptor());
58          }else
59              return false;
60      }
61  
62      public PropertyDescriptor getPropertyDescriptor() {
63          return propertyDescriptor;
64      }
65      
66  }