Class MethodInjectorFactory

java.lang.Object
com.cedarsoftware.io.reflect.factories.MethodInjectorFactory
All Implemented Interfaces:
InjectorFactory

public class MethodInjectorFactory extends Object implements InjectorFactory
Author:
Kenny Partlow ([email protected])
Copyright (c) Cedar Software LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Constructor Details

    • MethodInjectorFactory

      public MethodInjectorFactory()
  • Method Details

    • createInjector

      public Injector createInjector(Field field, Map<Class<?>,Map<String,String>> nonStandardNames, String uniqueName)
      Creates an Injector for the specified field, using optional custom method mappings and a unique name.

      This method determines the appropriate method name to use when injecting a value into the given field. It first checks for a custom method name mapping in the provided nonStandardNames map. If a custom method name is found for the field, it uses that method name. Otherwise, it generates a default setter method name based on the field name.

      Specified by:
      createInjector in interface InjectorFactory
      Parameters:
      field - the Field for which the injector is to be created
      nonStandardNames - a map of classes to field-to-method name mappings, used for custom method names
      uniqueName - a unique identifier for the injector, used to distinguish it from others
      Returns:
      an Injector configured with the appropriate method to inject values into the field