1 24 package javax.jcr; 25 26 import java.util.Calendar ; 27 28 35 public class SoftLinkValue extends BaseValue { 36 37 public static final int TYPE = PropertyType.SOFTLINK; 38 39 private final String path; 40 41 47 public SoftLinkValue(String path) { 48 super(TYPE); 49 this.path = path; 51 } 52 53 64 public boolean equals(Object obj) { 65 if (this == obj) { 66 return true; 67 } 68 if (obj instanceof SoftLinkValue) { 69 SoftLinkValue other = (SoftLinkValue) obj; 70 if (path == other.path) { 71 return true; 72 } else if (path != null && other.path != null) { 73 return path.equals(other.path); 74 } 75 } 76 return false; 77 } 78 79 83 public Calendar getDate() throws ValueFormatException, IllegalStateException , RepositoryException { 84 setValueConsumed(); 85 86 throw new ValueFormatException("conversion to date failed: inconvertible types"); 87 } 88 89 92 public long getLong() throws ValueFormatException, IllegalStateException , RepositoryException { 93 setValueConsumed(); 94 95 throw new ValueFormatException("conversion to long failed: inconvertible types"); 96 } 97 98 101 public boolean getBoolean() throws ValueFormatException, IllegalStateException , RepositoryException { 102 setValueConsumed(); 103 104 throw new ValueFormatException("conversion to boolean failed: inconvertible types"); 105 } 106 107 110 public double getDouble() throws ValueFormatException, IllegalStateException , RepositoryException { 111 setValueConsumed(); 112 113 throw new ValueFormatException("conversion to double failed: inconvertible types"); 114 } 115 116 119 public String getString() throws ValueFormatException, IllegalStateException , RepositoryException { 120 setValueConsumed(); 121 122 if (path != null) { 123 return path; 124 } else { 125 throw new ValueFormatException("empty value"); 126 } 127 } 128 } 129
| Popular Tags
|