1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  * ident	"%Z%%M%	%I%	%E% SMI"
27  */
28 package org.opensolaris.os.dtrace;
29 
30 import java.beans.*;
31 
32 /**
33  * A {@code long} value aggregated by the DTrace {@code min()} action.
34  * <p>
35  * Immutable.  Supports persistence using {@link java.beans.XMLEncoder}.
36  *
37  * @see Aggregation
38  * @author Tom Erickson
39  */
40 public final class MinValue extends AbstractAggregationValue {
41     static final long serialVersionUID = -3903522347795401289L;
42 
43     static {
44 	try {
45 	    BeanInfo info = Introspector.getBeanInfo(MinValue.class);
46 	    PersistenceDelegate persistenceDelegate =
47 		    new DefaultPersistenceDelegate(
48 		    new String[] {"value"});
49 	    BeanDescriptor d = info.getBeanDescriptor();
50 	    d.setValue("persistenceDelegate", persistenceDelegate);
51 	} catch (IntrospectionException e) {
52 	    System.out.println(e);
53 	}
54     }
55 
56     /**
57      * Creates a value aggregated by the DTrace {@code min()} action.
58      * Supports XML persistence.
59      *
60      * @param v minimum of the aggregated values
61      */
62     public
MinValue(long v)63     MinValue(long v)
64     {
65 	super(v);
66     }
67 
68     // Needed to support XML persistence since XMLDecoder cannot find
69     // the public method of the non-public superclass.
70 
71     /**
72      * Gets the minimum of the aggregated values.
73      *
74      * @return the minimum of the aggregated values
75      */
76     public Long
getValue()77     getValue()
78     {
79 	return (Long)super.getValue();
80     }
81 }
82