1 /**
2 * Copyright (c) 2008, The JUNG Authors
3 *
4 * All rights reserved.
5 *
6 * This software is open-source under the BSD license; see either
7 * "license.txt" or
8 * https://github.com/jrtom/jung/blob/master/LICENSE for a description.
9 * Created on Jun 30, 2008
10 *
11 */
12 package edu.uci.ics.jung.io;
13
14 import com.google.common.base.Function;
15
16 /**
17 * Maintains information relating to data for the specified type.
18 * This includes a Function from objects to their values,
19 * a default value, and a description.
20 */
21 public class GraphMLMetadata<T>
22 {
23 /**
24 * The description of this data type.
25 */
26 public String description;
27
28 /**
29 * The default value for objects of this type.
30 */
31 public String default_value;
32
33 /**
34 * A Function mapping objects to string representations of their values.
35 */
36 public Function<T, String> transformer;
37
38 /**
39 * Creates a new instance with the specified description,
40 * default value, and function.
41 *
42 * @param description a textual description of the object
43 * @param default_value the default value for the object, as a String
44 * @param function maps objects of this type to string representations
45 */
46 public GraphMLMetadata(String description, String default_value,
47 Function<T, String> function)
48 {
49 this.description = description;
50 this.transformer = function;
51 this.default_value = default_value;
52 }
53 }