001/*
002 * Copyright 2002-2017 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;
020import org.springframework.util.StringUtils;
021
022/**
023 * Metadata that indicates a JMX notification emitted by a bean.
024 *
025 * @author Rob Harrop
026 * @since 2.0
027 */
028public class ManagedNotification {
029
030        @Nullable
031        private String[] notificationTypes;
032
033        @Nullable
034        private String name;
035
036        @Nullable
037        private String description;
038
039
040        /**
041         * Set a single notification type, or a list of notification types
042         * as comma-delimited String.
043         */
044        public void setNotificationType(String notificationType) {
045                this.notificationTypes = StringUtils.commaDelimitedListToStringArray(notificationType);
046        }
047
048        /**
049         * Set a list of notification types.
050         */
051        public void setNotificationTypes(@Nullable String... notificationTypes) {
052                this.notificationTypes = notificationTypes;
053        }
054
055        /**
056         * Return the list of notification types.
057         */
058        @Nullable
059        public String[] getNotificationTypes() {
060                return this.notificationTypes;
061        }
062
063        /**
064         * Set the name of this notification.
065         */
066        public void setName(@Nullable String name) {
067                this.name = name;
068        }
069
070        /**
071         * Return the name of this notification.
072         */
073        @Nullable
074        public String getName() {
075                return this.name;
076        }
077
078        /**
079         * Set a description for this notification.
080         */
081        public void setDescription(@Nullable String description) {
082                this.description = description;
083        }
084
085        /**
086         * Return a description for this notification.
087         */
088        @Nullable
089        public String getDescription() {
090                return this.description;
091        }
092
093}