@Test public void testGetValueFor() { for (MetadataContainer curr : createTestContainers()) { Assert.assertEquals("", curr.getValueFor("testKey")); Assert.assertFalse(curr.hasDescriptor("testKey")); curr.setStringValue("testKey", "testValue"); Assert.assertTrue(curr.hasDescriptor("testKey")); Assert.assertEquals("testValue", curr.getValueFor("testKey")); } }
protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; }
MetadataContainer extends Chunk implements WriteableChunk { protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; } }
MetadataContainer extends Chunk implements WriteableChunk { protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; } MetadataContainer(final ContainerType type);  MetadataContainer(final ContainerType type, final long pos, final BigInteger size);  MetadataContainer(final GUID containerGUID, final long pos, final BigInteger size); }
MetadataContainer extends Chunk implements WriteableChunk { protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; } MetadataContainer(final ContainerType type);  MetadataContainer(final ContainerType type, final long pos, final BigInteger size);  MetadataContainer(final GUID containerGUID, final long pos, final BigInteger size); final void addDescriptor(final MetadataDescriptor toAdd); final boolean containsDescriptor(final MetadataDescriptor lookup); final ContainerType getContainerType(); long getCurrentAsfChunkSize(); final int getDescriptorCount(); final List<MetadataDescriptor> getDescriptors(); final List<MetadataDescriptor> getDescriptorsByName(final String name); final boolean hasDescriptor(final String name); boolean isAddSupported(final MetadataDescriptor descriptor); final boolean isEmpty(); @Override String prettyPrint(final String prefix); final void removeDescriptorsByName(final String name); long writeInto(final OutputStream out); }
MetadataContainer extends Chunk implements WriteableChunk { protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; } MetadataContainer(final ContainerType type);  MetadataContainer(final ContainerType type, final long pos, final BigInteger size);  MetadataContainer(final GUID containerGUID, final long pos, final BigInteger size); final void addDescriptor(final MetadataDescriptor toAdd); final boolean containsDescriptor(final MetadataDescriptor lookup); final ContainerType getContainerType(); long getCurrentAsfChunkSize(); final int getDescriptorCount(); final List<MetadataDescriptor> getDescriptors(); final List<MetadataDescriptor> getDescriptorsByName(final String name); final boolean hasDescriptor(final String name); boolean isAddSupported(final MetadataDescriptor descriptor); final boolean isEmpty(); @Override String prettyPrint(final String prefix); final void removeDescriptorsByName(final String name); long writeInto(final OutputStream out);  }