< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstat/ColumnFormat.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -39,10 +39,11 @@
     private Alignment align = Alignment.CENTER;
     private Scale scale = Scale.RAW;
     private String format;
     private String header;
     private Expression expression;
+    private boolean required = false;
     private Object previousValue;
 
     public ColumnFormat(int number) {
         super("Column" + number);
         this.number = number;

@@ -69,10 +70,13 @@
         if (format == null) {
             // if no formating is specified, then the format is set to output
             // the raw data.
             format="0";
         }
+
+        // Adjust required flag
+        expression.setRequired(required);
     }
 
     public void setWidth(int width) {
         this.width = width;
     }

@@ -119,10 +123,18 @@
 
     public void setExpression(Expression e) {
         this.expression = e;
     }
 
+    public void setRequired(boolean r) {
+        this.required = r;
+    }
+
+    public boolean isRequired() {
+        return this.required;
+    }
+
     public void setPreviousValue(Object o) {
         this.previousValue = o;
     }
 
     public Object getPreviousValue() {

@@ -139,11 +151,12 @@
 
         System.out.println(indent + name + " {");
         System.out.println(indent + indentAmount + "name=" + name
                 + ";data=" + expression.toString() + ";header=" + header
                 + ";format=" + format + ";width=" + width
-                + ";scale=" + scale.toString() + ";align=" + align.toString());
+                + ";scale=" + scale.toString() + ";align=" + align.toString()
+                + ";required=" + required);
 
         for (Iterator<OptionFormat> i = children.iterator();  i.hasNext(); /* empty */) {
             OptionFormat of = i.next();
             of.printFormat(indentLevel+1);
         }
< prev index next >