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.autoconfigure.metrics.export.simple; 018 019import java.time.Duration; 020 021import io.micrometer.core.instrument.simple.CountingMode; 022import io.micrometer.core.instrument.simple.SimpleConfig; 023 024import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter; 025 026/** 027 * Adapter to convert {@link SimpleProperties} to a {@link SimpleConfig}. 028 * 029 * @author Jon Schneider 030 * @since 2.0.0 031 */ 032public class SimplePropertiesConfigAdapter 033 extends PropertiesConfigAdapter<SimpleProperties> implements SimpleConfig { 034 035 public SimplePropertiesConfigAdapter(SimpleProperties properties) { 036 super(properties); 037 } 038 039 @Override 040 public String get(String k) { 041 return null; 042 } 043 044 @Override 045 public Duration step() { 046 return get(SimpleProperties::getStep, SimpleConfig.super::step); 047 } 048 049 @Override 050 public CountingMode mode() { 051 return get(SimpleProperties::getMode, SimpleConfig.super::mode); 052 } 053 054}