1 package org.apache.maven.configuration; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 /** 23 * A request to configure a bean from some configuration in the POM or similar. 24 * 25 * @author Benjamin Bentmann 26 */ 27 public interface BeanConfigurationRequest 28 { 29 30 /** 31 * Gets the bean to configure. Eventually, a valid request must have a bean set. 32 * 33 * @return The bean to configure, or {@code null} if none. 34 */ 35 Object getBean(); 36 37 /** 38 * Sets the bean to configure. Eventually, a valid request must have a bean set. 39 * 40 * @param bean The bean to configure, may be {@code null}. 41 * @return This request for chaining, never {@code null}. 42 */ 43 BeanConfigurationRequest setBean( Object bean ); 44 45 /** 46 * Gets the configuration to unmarshal into the bean. 47 * 48 * @return The configuration to unmarshal into the bean or {@code null} if none. 49 */ 50 Object getConfiguration(); 51 52 /** 53 * Sets the configuration to unmarshal into the bean. The configuration should be taken from 54 * {@link org.apache.maven.model.ConfigurationContainer#getConfiguration()} or a similar source. 55 * 56 * @param configuration The configuration to unmarshal, may be {@code null}. 57 * @return This request for chaining, never {@code null}. 58 */ 59 BeanConfigurationRequest setConfiguration( Object configuration ); 60 61 /** 62 * Gets the class loader from which to load any types referenced by the configuration. If unset, the class loader of 63 * the bean class will be used. 64 * 65 * @return The class loader to load referenced types from or {@code null} if unset. 66 */ 67 ClassLoader getClassLoader(); 68 69 /** 70 * Sets the class loader from which to load any types referenced by the configuration. If unset, the class loader of 71 * the bean class will be used. 72 * 73 * @param classLoader The class loader to load referenced types from, may be {@code null}. 74 * @return This request for chaining, never {@code null}. 75 */ 76 BeanConfigurationRequest setClassLoader( ClassLoader classLoader ); 77 78 /** 79 * Gets the optional preprocessor for configuration values. 80 * 81 * @return The preprocessor for configuration values or {@code null} if none. 82 */ 83 BeanConfigurationValuePreprocessor getValuePreprocessor(); 84 85 /** 86 * Sets the optional preprocessor for configuration values. 87 * 88 * @param valuePreprocessor The preprocessor for configuration values, may be {@code null} if unneeded. 89 * @return This request for chaining, never {@code null}. 90 */ 91 BeanConfigurationRequest setValuePreprocessor( BeanConfigurationValuePreprocessor valuePreprocessor ); 92 93 /** 94 * Gets the optional path translator for configuration values unmarshalled to files. 95 * 96 * @return The path translator for files or {@code null} if none. 97 */ 98 BeanConfigurationPathTranslator getPathTranslator(); 99 100 /** 101 * Sets the optional path translator for configuration values unmarshalled to files. 102 * 103 * @param pathTranslator The path translator for files, may be {@code null} if unneeded. 104 * @return This request for chaining, never {@code null}. 105 */ 106 BeanConfigurationRequest setPathTranslator( BeanConfigurationPathTranslator pathTranslator ); 107 108 }