pixelmed
JPEGLosslessMetadataFormat.java
Go to the documentation of this file.
1 /* Copyright (c) 2015, David A. Clunie DBA Pixelmed Publishing. All rights reserved. */
2 
3 package com.pixelmed.imageio;
4 
5 // follow the pattern described in "http://docs.oracle.com/javase/1.5.0/docs/guide/imageio/spec/extending.fm3.html"
6 
7 import javax.imageio.ImageTypeSpecifier;
8 import javax.imageio.metadata.IIOMetadataFormatImpl;
9 
10 public class JPEGLosslessMetadataFormat extends IIOMetadataFormatImpl {
11 
12  private static final String identString = "@(#) $Header: /userland/cvs/codec/com/pixelmed/imageio/JPEGLosslessMetadataFormat.java,v 1.2 2015/10/19 15:34:42 dclunie Exp $";
13 
14  // Create a single instance of this class (singleton pattern)
15  private static JPEGLosslessMetadataFormat defaultInstance = new JPEGLosslessMetadataFormat();
16 
17  // Make constructor private to enforce the singleton pattern
18  private JPEGLosslessMetadataFormat() {
19  // Set the name of the root node
20  // The root node has a single child node type that may repeat
21  super("com.pixelmed.imageio.JPEGLosslessMetadata_0.1",
22  CHILD_POLICY_REPEAT);
23 
24  // Set up the "KeywordValuePair" node, which has no children
25  addElement("KeywordValuePair",
26  "com.pixelmed.imageio.JPEGLosslessMetadata_0.1",
27  CHILD_POLICY_EMPTY);
28 
29  // Set up attribute "keyword" which is a String that is required
30  // and has no default value
31  addAttribute("KeywordValuePair", "keyword", DATATYPE_STRING,
32  true, null);
33  // Set up attribute "value" which is a String that is required
34  // and has no default value
35  addAttribute("KeywordValuePair", "value", DATATYPE_STRING,
36  true, null);
37  }
38 
39  // Check for legal element name
40  public boolean canNodeAppear(String elementName,ImageTypeSpecifier imageType) {
41  return elementName.equals("KeywordValuePair");
42  }
43 
44  // Return the singleton instance
46  return defaultInstance;
47  }
48 }
boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType)