001/*
002 * Copyright 2012-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 *      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
017package org.springframework.boot.actuate.web.mappings.servlet;
018
019import javax.servlet.Registration;
020
021/**
022 * A mapping description derived from a {@link Registration}.
023 *
024 * @param <T> type of the registration
025 * @author Andy Wilkinson
026 * @since 2.0.0
027 */
028public class RegistrationMappingDescription<T extends Registration> {
029
030        private final T registration;
031
032        /**
033         * Creates a new {@link RegistrationMappingDescription} derived from the given
034         * {@code registration} and with the given {@code predicate}.
035         * @param registration the registration
036         */
037        public RegistrationMappingDescription(T registration) {
038                this.registration = registration;
039        }
040
041        /**
042         * Returns the name of the registered Filter or Servlet.
043         * @return the name
044         */
045        public String getName() {
046                return this.registration.getName();
047        }
048
049        /**
050         * Returns the class name of the registered Filter or Servlet.
051         * @return the class name
052         */
053        public String getClassName() {
054                return this.registration.getClassName();
055        }
056
057        /**
058         * Returns the registration that is being described.
059         * @return the registration
060         */
061        protected final T getRegistration() {
062                return this.registration;
063        }
064
065}