001/*
002 * Copyright 2002-2018 the original author or authors.
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 *      https://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
017package org.springframework.jmx.export.metadata;
018
019import org.springframework.lang.Nullable;
020
021/**
022 * Metadata that indicates to expose a given bean property as JMX attribute.
023 * Only valid when used on a JavaBean getter or setter.
024 *
025 * @author Rob Harrop
026 * @since 1.2
027 * @see org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
028 * @see org.springframework.jmx.export.MBeanExporter
029 */
030public class ManagedAttribute extends AbstractJmxAttribute {
031
032        /**
033         * Empty attributes.
034         */
035        public static final ManagedAttribute EMPTY = new ManagedAttribute();
036
037
038        @Nullable
039        private Object defaultValue;
040
041        @Nullable
042        private String persistPolicy;
043
044        private int persistPeriod = -1;
045
046
047        /**
048         * Set the default value of this attribute.
049         */
050        public void setDefaultValue(@Nullable Object defaultValue) {
051                this.defaultValue = defaultValue;
052        }
053
054        /**
055         * Return the default value of this attribute.
056         */
057        @Nullable
058        public Object getDefaultValue() {
059                return this.defaultValue;
060        }
061
062        public void setPersistPolicy(@Nullable String persistPolicy) {
063                this.persistPolicy = persistPolicy;
064        }
065
066        @Nullable
067        public String getPersistPolicy() {
068                return this.persistPolicy;
069        }
070
071        public void setPersistPeriod(int persistPeriod) {
072                this.persistPeriod = persistPeriod;
073        }
074
075        public int getPersistPeriod() {
076                return this.persistPeriod;
077        }
078
079}