001    /*
002     *  Copyright 2001-2013 Stephen Colebourne
003     *
004     *  Licensed under the Apache License, Version 2.0 (the "License");
005     *  you may not use this file except in compliance with the License.
006     *  You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     *  Unless required by applicable law or agreed to in writing, software
011     *  distributed under the License is distributed on an "AS IS" BASIS,
012     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     *  See the License for the specific language governing permissions and
014     *  limitations under the License.
015     */
016    package org.joda.beans;
017    
018    /**
019     * An enumeration of read-write property types.
020     * <p>
021     * A property may be read-only, read-write or write-only.
022     * This enumeration models those options.
023     * 
024     * @author Stephen Colebourne
025     */
026    public enum PropertyReadWrite {
027    
028        /**
029         * The property can be read and written.
030         */
031        READ_WRITE(),
032        /**
033         * The property is read-only.
034         */
035        READ_ONLY(),
036        /**
037         * The property is write-only.
038         */
039        WRITE_ONLY();
040    
041        //-----------------------------------------------------------------------
042        /**
043         * Checks whether the property is readable.
044         * 
045         * @return true if the property can be read
046         */
047        public boolean isReadable() {
048            return this != WRITE_ONLY;
049        }
050    
051        /**
052         * Checks whether the property is writable.
053         * 
054         * @return true if the property can be written
055         */
056        public boolean isWritable() {
057          return this != READ_ONLY;
058        }
059    
060    }