Changeset 10862 in josm for trunk/src/com/drew/metadata/iptc/IptcDescriptor.java
- Timestamp:
- 2016-08-20T20:58:03+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/iptc/IptcDescriptor.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 26 26 import com.drew.metadata.TagDescriptor; 27 27 28 import static com.drew.metadata.iptc.IptcDirectory.*; 29 28 30 /** 29 31 * Provides human-readable string representations of tag values stored in a {@link IptcDirectory}. … … 45 47 { 46 48 switch (tagType) { 47 case IptcDirectory.TAG_FILE_FORMAT: 49 case TAG_DATE_CREATED: 50 return getDateCreatedDescription(); 51 case TAG_DIGITAL_DATE_CREATED: 52 return getDigitalDateCreatedDescription(); 53 case TAG_DATE_SENT: 54 return getDateSentDescription(); 55 case TAG_EXPIRATION_DATE: 56 return getExpirationDateDescription(); 57 case TAG_EXPIRATION_TIME: 58 return getExpirationTimeDescription(); 59 case TAG_FILE_FORMAT: 48 60 return getFileFormatDescription(); 49 case IptcDirectory.TAG_KEYWORDS:61 case TAG_KEYWORDS: 50 62 return getKeywordsDescription(); 51 case IptcDirectory.TAG_TIME_CREATED: 63 case TAG_REFERENCE_DATE: 64 return getReferenceDateDescription(); 65 case TAG_RELEASE_DATE: 66 return getReleaseDateDescription(); 67 case TAG_RELEASE_TIME: 68 return getReleaseTimeDescription(); 69 case TAG_TIME_CREATED: 52 70 return getTimeCreatedDescription(); 53 case IptcDirectory.TAG_DIGITAL_TIME_CREATED:71 case TAG_DIGITAL_TIME_CREATED: 54 72 return getDigitalTimeCreatedDescription(); 73 case TAG_TIME_SENT: 74 return getTimeSentDescription(); 55 75 default: 56 76 return super.getDescription(tagType); … … 59 79 60 80 @Nullable 81 public String getDateDescription(int tagType) 82 { 83 String s = _directory.getString(tagType); 84 if (s == null) 85 return null; 86 if (s.length() == 8) 87 return s.substring(0, 4) + ':' + s.substring(4, 6) + ':' + s.substring(6); 88 return s; 89 } 90 91 @Nullable 92 public String getTimeDescription(int tagType) 93 { 94 String s = _directory.getString(tagType); 95 if (s == null) 96 return null; 97 if (s.length() == 6 || s.length() == 11) 98 return s.substring(0, 2) + ':' + s.substring(2, 4) + ':' + s.substring(4); 99 return s; 100 } 101 102 @Nullable 61 103 public String getFileFormatDescription() 62 104 { 63 Integer value = _directory.getInteger( IptcDirectory.TAG_FILE_FORMAT);105 Integer value = _directory.getInteger(TAG_FILE_FORMAT); 64 106 if (value == null) 65 107 return null; … … 102 144 public String getByLineDescription() 103 145 { 104 return _directory.getString( IptcDirectory.TAG_BY_LINE);146 return _directory.getString(TAG_BY_LINE); 105 147 } 106 148 … … 108 150 public String getByLineTitleDescription() 109 151 { 110 return _directory.getString( IptcDirectory.TAG_BY_LINE_TITLE);152 return _directory.getString(TAG_BY_LINE_TITLE); 111 153 } 112 154 … … 114 156 public String getCaptionDescription() 115 157 { 116 return _directory.getString( IptcDirectory.TAG_CAPTION);158 return _directory.getString(TAG_CAPTION); 117 159 } 118 160 … … 120 162 public String getCategoryDescription() 121 163 { 122 return _directory.getString( IptcDirectory.TAG_CATEGORY);164 return _directory.getString(TAG_CATEGORY); 123 165 } 124 166 … … 126 168 public String getCityDescription() 127 169 { 128 return _directory.getString( IptcDirectory.TAG_CITY);170 return _directory.getString(TAG_CITY); 129 171 } 130 172 … … 132 174 public String getCopyrightNoticeDescription() 133 175 { 134 return _directory.getString( IptcDirectory.TAG_COPYRIGHT_NOTICE);176 return _directory.getString(TAG_COPYRIGHT_NOTICE); 135 177 } 136 178 … … 138 180 public String getCountryOrPrimaryLocationDescription() 139 181 { 140 return _directory.getString( IptcDirectory.TAG_COUNTRY_OR_PRIMARY_LOCATION_NAME);182 return _directory.getString(TAG_COUNTRY_OR_PRIMARY_LOCATION_NAME); 141 183 } 142 184 … … 144 186 public String getCreditDescription() 145 187 { 146 return _directory.getString( IptcDirectory.TAG_CREDIT);188 return _directory.getString(TAG_CREDIT); 147 189 } 148 190 … … 150 192 public String getDateCreatedDescription() 151 193 { 152 return _directory.getString(IptcDirectory.TAG_DATE_CREATED); 194 return getDateDescription(TAG_DATE_CREATED); 195 } 196 197 @Nullable 198 public String getDigitalDateCreatedDescription() 199 { 200 return getDateDescription(TAG_DIGITAL_DATE_CREATED); 201 } 202 203 @Nullable 204 public String getDateSentDescription() 205 { 206 return getDateDescription(TAG_DATE_SENT); 207 } 208 209 @Nullable 210 public String getExpirationDateDescription() 211 { 212 return getDateDescription(TAG_EXPIRATION_DATE); 213 } 214 215 @Nullable 216 public String getExpirationTimeDescription() 217 { 218 return getTimeDescription(TAG_EXPIRATION_TIME); 153 219 } 154 220 … … 156 222 public String getHeadlineDescription() 157 223 { 158 return _directory.getString( IptcDirectory.TAG_HEADLINE);224 return _directory.getString(TAG_HEADLINE); 159 225 } 160 226 … … 162 228 public String getKeywordsDescription() 163 229 { 164 final String[] keywords = _directory.getStringArray( IptcDirectory.TAG_KEYWORDS);230 final String[] keywords = _directory.getStringArray(TAG_KEYWORDS); 165 231 if (keywords==null) 166 232 return null; … … 171 237 public String getObjectNameDescription() 172 238 { 173 return _directory.getString( IptcDirectory.TAG_OBJECT_NAME);239 return _directory.getString(TAG_OBJECT_NAME); 174 240 } 175 241 … … 177 243 public String getOriginalTransmissionReferenceDescription() 178 244 { 179 return _directory.getString( IptcDirectory.TAG_ORIGINAL_TRANSMISSION_REFERENCE);245 return _directory.getString(TAG_ORIGINAL_TRANSMISSION_REFERENCE); 180 246 } 181 247 … … 183 249 public String getOriginatingProgramDescription() 184 250 { 185 return _directory.getString( IptcDirectory.TAG_ORIGINATING_PROGRAM);251 return _directory.getString(TAG_ORIGINATING_PROGRAM); 186 252 } 187 253 … … 189 255 public String getProvinceOrStateDescription() 190 256 { 191 return _directory.getString( IptcDirectory.TAG_PROVINCE_OR_STATE);257 return _directory.getString(TAG_PROVINCE_OR_STATE); 192 258 } 193 259 … … 195 261 public String getRecordVersionDescription() 196 262 { 197 return _directory.getString(IptcDirectory.TAG_APPLICATION_RECORD_VERSION); 263 return _directory.getString(TAG_APPLICATION_RECORD_VERSION); 264 } 265 266 @Nullable 267 public String getReferenceDateDescription() 268 { 269 return getDateDescription(TAG_REFERENCE_DATE); 198 270 } 199 271 … … 201 273 public String getReleaseDateDescription() 202 274 { 203 return _directory.getString(IptcDirectory.TAG_RELEASE_DATE);275 return getDateDescription(TAG_RELEASE_DATE); 204 276 } 205 277 … … 207 279 public String getReleaseTimeDescription() 208 280 { 209 return _directory.getString(IptcDirectory.TAG_RELEASE_TIME);281 return getTimeDescription(TAG_RELEASE_TIME); 210 282 } 211 283 … … 213 285 public String getSourceDescription() 214 286 { 215 return _directory.getString( IptcDirectory.TAG_SOURCE);287 return _directory.getString(TAG_SOURCE); 216 288 } 217 289 … … 219 291 public String getSpecialInstructionsDescription() 220 292 { 221 return _directory.getString( IptcDirectory.TAG_SPECIAL_INSTRUCTIONS);293 return _directory.getString(TAG_SPECIAL_INSTRUCTIONS); 222 294 } 223 295 … … 225 297 public String getSupplementalCategoriesDescription() 226 298 { 227 return _directory.getString( IptcDirectory.TAG_SUPPLEMENTAL_CATEGORIES);299 return _directory.getString(TAG_SUPPLEMENTAL_CATEGORIES); 228 300 } 229 301 … … 231 303 public String getTimeCreatedDescription() 232 304 { 233 String s = _directory.getString(IptcDirectory.TAG_TIME_CREATED); 234 if (s == null) 235 return null; 236 if (s.length() == 6 || s.length() == 11) 237 return s.substring(0, 2) + ':' + s.substring(2, 4) + ':' + s.substring(4); 238 return s; 305 return getTimeDescription(TAG_TIME_CREATED); 239 306 } 240 307 … … 242 309 public String getDigitalTimeCreatedDescription() 243 310 { 244 String s = _directory.getString(IptcDirectory.TAG_DIGITAL_TIME_CREATED); 245 if (s == null) 246 return null; 247 if (s.length() == 6 || s.length() == 11) 248 return s.substring(0, 2) + ':' + s.substring(2, 4) + ':' + s.substring(4); 249 return s; 311 return getTimeDescription(TAG_DIGITAL_TIME_CREATED); 312 } 313 314 @Nullable 315 public String getTimeSentDescription() 316 { 317 return getTimeDescription(TAG_TIME_SENT); 250 318 } 251 319 … … 253 321 public String getUrgencyDescription() 254 322 { 255 return _directory.getString( IptcDirectory.TAG_URGENCY);323 return _directory.getString(TAG_URGENCY); 256 324 } 257 325 … … 259 327 public String getWriterDescription() 260 328 { 261 return _directory.getString( IptcDirectory.TAG_CAPTION_WRITER);329 return _directory.getString(TAG_CAPTION_WRITER); 262 330 } 263 331 }
Note:
See TracChangeset
for help on using the changeset viewer.
