File Source: PropertyDef.java

         /* 
    P/P   *  Method: org.apache.roller.weblogger.config.runtime.PropertyDef__static_init
          */
     1  /*
     2  * Licensed to the Apache Software Foundation (ASF) under one or more
     3  *  contributor license agreements.  The ASF licenses this file to You
     4  * under the Apache License, Version 2.0 (the "License"); you may not
     5  * use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *     http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.  For additional information regarding
    15  * copyright in this work, please see the NOTICE file in the top level
    16  * directory of this distribution.
    17  */
    18  /*
    19   * PropertyDef.java
    20   *
    21   * Created on June 4, 2005, 1:13 PM
    22   */
    23  
    24  package org.apache.roller.weblogger.config.runtime;
    25  
    26  /**
    27   * Represents the definition of a single runtime property.
    28   *
    29   * Each property definition may contain these elements
    30   *   - name (required)
    31   *   - key (required)
    32   *   - type (required)
    33   *   - default-value (required)
    34   *   - rows (optional)
    35   *   - cols (options)
    36   *
    37   * @author Allen Gilliland
    38   */
    39  public class PropertyDef {
    40      
    41      private String name = null;
    42      private String key = null;
    43      private String type = null;
    44      private String defaultValue = null;
    45      private int rows = 5;
    46      private int cols = 25;
    47      
    48      
    49      /** Creates a new instance of PropertyDef */
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.config.runtime.PropertyDef()
              * 
              *  Postconditions:
              *    this.cols == 25
              *    this.defaultValue == null
              *    this.key == null
              *    this.name == null
              *    this.type == null
              *    this.rows == 5
              */
    50      public PropertyDef() {}
    51  
    52      public String toString() {
                 /* 
    P/P           *  Method: String toString()
                  * 
                  *  Preconditions:
                  *    init'ed(this.cols)
                  *    init'ed(this.defaultValue)
                  *    init'ed(this.key)
                  *    init'ed(this.name)
                  *    init'ed(this.rows)
                  *    init'ed(this.type)
                  * 
                  *  Postconditions:
                  *    java.lang.StringBuilder:toString(...)._tainted == 0
                  *    return_value == &java.lang.StringBuilder:toString(...)
                  */
    53          return "["+name+","+key+","+type+","+defaultValue+","+rows+","+cols+"]";
    54      }
    55      
    56      public String getName() {
                 /* 
    P/P           *  Method: String getName()
                  * 
                  *  Preconditions:
                  *    init'ed(this.name)
                  * 
                  *  Postconditions:
                  *    return_value == this.name
                  *    init'ed(return_value)
                  */
    57          return name;
    58      }
    59  
    60      public void setName(String name) {
                 /* 
    P/P           *  Method: void setName(String)
                  * 
                  *  Postconditions:
                  *    this.name == name
                  *    init'ed(this.name)
                  */
    61          this.name = name;
    62      }
    63  
    64      public String getKey() {
                 /* 
    P/P           *  Method: String getKey()
                  * 
                  *  Preconditions:
                  *    init'ed(this.key)
                  * 
                  *  Postconditions:
                  *    return_value == this.key
                  *    init'ed(return_value)
                  */
    65          return key;
    66      }
    67  
    68      public void setKey(String key) {
                 /* 
    P/P           *  Method: void setKey(String)
                  * 
                  *  Postconditions:
                  *    this.key == key
                  *    init'ed(this.key)
                  */
    69          this.key = key;
    70      }
    71  
    72      public String getType() {
                 /* 
    P/P           *  Method: String getType()
                  * 
                  *  Preconditions:
                  *    init'ed(this.type)
                  * 
                  *  Postconditions:
                  *    return_value == this.type
                  *    init'ed(return_value)
                  */
    73          return type;
    74      }
    75  
    76      public void setType(String type) {
                 /* 
    P/P           *  Method: void setType(String)
                  * 
                  *  Postconditions:
                  *    this.type == type
                  *    init'ed(this.type)
                  */
    77          this.type = type;
    78      }
    79  
    80      public String getDefaultValue() {
                 /* 
    P/P           *  Method: String getDefaultValue()
                  * 
                  *  Preconditions:
                  *    init'ed(this.defaultValue)
                  * 
                  *  Postconditions:
                  *    return_value == this.defaultValue
                  *    init'ed(return_value)
                  */
    81          return defaultValue;
    82      }
    83  
    84      public void setDefaultValue(String defaultvalue) {
                 /* 
    P/P           *  Method: void setDefaultValue(String)
                  * 
                  *  Postconditions:
                  *    this.defaultValue == defaultvalue
                  *    init'ed(this.defaultValue)
                  */
    85          this.defaultValue = defaultvalue;
    86      }
    87  
    88      public int getRows() {
                 /* 
    P/P           *  Method: int getRows()
                  * 
                  *  Preconditions:
                  *    init'ed(this.rows)
                  * 
                  *  Postconditions:
                  *    return_value == this.rows
                  *    init'ed(return_value)
                  */
    89          return rows;
    90      }
    91  
    92      public void setRows(int rows) {
                 /* 
    P/P           *  Method: void setRows(int)
                  * 
                  *  Postconditions:
                  *    this.rows == rows
                  *    init'ed(this.rows)
                  */
    93          this.rows = rows;
    94      }
    95  
    96      public void setRows(String rows) {
    97          //convert to int
    98          try {
                     /* 
    P/P               *  Method: void setRows(String)
                      * 
                      *  Postconditions:
                      *    possibly_updated(this.rows)
                      */
    99              int r = Integer.parseInt(rows);
   100              this.rows = r;
   101          } catch(Exception e) {
   102              // hmmm ... bogus value
   103          }
   104      }
   105      public int getCols() {
                 /* 
    P/P           *  Method: int getCols()
                  * 
                  *  Preconditions:
                  *    init'ed(this.cols)
                  * 
                  *  Postconditions:
                  *    return_value == this.cols
                  *    init'ed(return_value)
                  */
   106          return cols;
   107      }
   108  
   109      public void setCols(int cols) {
                 /* 
    P/P           *  Method: void setCols(int)
                  * 
                  *  Postconditions:
                  *    this.cols == cols
                  *    init'ed(this.cols)
                  */
   110          this.cols = cols;
   111      }
   112      
   113      public void setCols(String cols) {
   114          //convert to int
   115          try {
                     /* 
    P/P               *  Method: void setCols(String)
                      * 
                      *  Postconditions:
                      *    possibly_updated(this.cols)
                      */
   116              int c = Integer.parseInt(cols);
   117              this.cols = c;
   118          } catch(Exception e) {
   119              // hmmm ... bogus value
   120          }
   121      }
   122  }








SofCheck Inspector Build Version : 2.18479
PropertyDef.java 2009-Jan-02 14:25:04
PropertyDef.class 2009-Sep-04 03:12:32