Changeset 8132 in josm for trunk/src/com/drew/metadata/Metadata.java
- Timestamp:
- 2015-03-10T01:17:39+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/Metadata.java
r6127 r8132 1 1 /* 2 * Copyright 2002-201 2Drew Noakes2 * Copyright 2002-2015 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 16 16 * More information about this project is available at: 17 17 * 18 * http ://drewnoakes.com/code/exif/19 * http ://code.google.com/p/metadata-extractor/18 * https://drewnoakes.com/code/exif/ 19 * https://github.com/drewnoakes/metadata-extractor 20 20 */ 21 21 package com.drew.metadata; … … 24 24 import com.drew.lang.annotations.Nullable; 25 25 26 import java.util.ArrayList; 27 import java.util.Collection; 28 import java.util.HashMap; 29 import java.util.Map; 26 import java.util.*; 30 27 31 28 /** 32 * A top-level object to hold the various types of metadata (Exif/IPTC/etc) related to one entity (such as a file 33 * or stream). 34 * <p/> 35 * Metadata objects may contain zero or more directories. Each directory may contain zero or more tags with 36 * corresponding values. 29 * A top-level object that holds the metadata values extracted from an image. 30 * <p> 31 * Metadata objects may contain zero or more {@link Directory} objects. Each directory may contain zero or more tags 32 * with corresponding values. 37 33 * 38 * @author Drew Noakes http ://drewnoakes.com34 * @author Drew Noakes https://drewnoakes.com 39 35 */ 40 36 public final class Metadata … … 42 38 @NotNull 43 39 private final Map<Class<? extends Directory>,Directory> _directoryByClass = new HashMap<Class<? extends Directory>, Directory>(); 44 40 45 41 /** 46 42 * List of Directory objects set against this object. Keeping a list handy makes … … 58 54 public Iterable<Directory> getDirectories() 59 55 { 60 return _directoryList;56 return Collections.unmodifiableCollection(_directoryList); 61 57 } 62 58 … … 72 68 73 69 /** 74 * Returns a <code>Directory</code> of specified type. If this <code>Metadata</code>object already contains70 * Returns a {@link Directory} of specified type. If this {@link Metadata} object already contains 75 71 * such a directory, it is returned. Otherwise a new instance of this directory will be created and stored within 76 * this Metadataobject.72 * this {@link Metadata} object. 77 73 * 78 74 * @param type the type of the Directory implementation required. … … 104 100 105 101 /** 106 * If this <code>Metadata</code> object contains a <code>Directory</code>of the specified type, it is returned.102 * If this {@link Metadata} object contains a {@link Directory} of the specified type, it is returned. 107 103 * Otherwise <code>null</code> is returned. 108 104 * 109 105 * @param type the Directory type 110 106 * @param <T> the Directory type 111 * @return a Directory of type T if it exists in this Metadataobject, otherwise <code>null</code>.107 * @return a Directory of type T if it exists in this {@link Metadata} object, otherwise <code>null</code>. 112 108 */ 113 109 @Nullable … … 123 119 /** 124 120 * Indicates whether a given directory type has been created in this metadata 125 * repository. Directories are created by calling <code>getOrCreateDirectory(Class)</code>.121 * repository. Directories are created by calling {@link Metadata#getOrCreateDirectory(Class)}. 126 122 * 127 * @param type the Directorytype128 * @return true if the metadata directoryhas been created123 * @param type the {@link Directory} type 124 * @return true if the {@link Directory} has been created 129 125 */ 130 126 public boolean containsDirectory(Class<? extends Directory> type) … … 135 131 /** 136 132 * Indicates whether any errors were reported during the reading of metadata values. 137 * This value will be true if Directory.hasErrors() is true for one of the contained Directoryobjects.133 * This value will be true if Directory.hasErrors() is true for one of the contained {@link Directory} objects. 138 134 * 139 135 * @return whether one of the contained directories has an error … … 147 143 return false; 148 144 } 145 146 @Override 147 public String toString() 148 { 149 return String.format("Metadata (%d %s)", 150 _directoryList.size(), 151 _directoryList.size() == 1 152 ? "directory" 153 : "directories"); 154 } 149 155 }
Note:
See TracChangeset
for help on using the changeset viewer.