Package com.cedarsoftware.util.reflect
Class ReflectionUtils
java.lang.Object
com.cedarsoftware.util.reflect.ReflectionUtils
- 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.*
-
Method Summary
Modifier and TypeMethodDescriptionbuildDeclaredFields
(Class<?> c) buildInjectorMap
(Class<?> c) Builds a list of methods with zero parameter methods taking precedence over overrides for a given single level class.getDeclaredFields
(Class<?> c) static <T> T
newInstance
(Class<? extends T> c) Creates an object using default constructor.static Method
oneParameterMethodPreference
(Method method1, Method method2) Binary Operator that returns a method with zero parameters on conflict.
-
Method Details
-
buildInjectorMap
Builds a list of methods with zero parameter methods taking precedence over overrides for a given single level class.- Parameters:
c
- - class to get the declared methods for- Returns:
- Map of name of the method to the actual emthod
-
oneParameterMethodPreference
Binary Operator that returns a method with zero parameters on conflict.- Parameters:
method1
- - 1st method to comparemethod2
- - 2nd method to compare- Returns:
- in the case over overloads choose the method with 0 parameters.
-
newInstance
public static <T> T newInstance(Class<? extends T> c) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException Creates an object using default constructor.- Parameters:
c
- - class to create- Returns:
- Object created using default constructor of class c
- Throws:
Exception
IllegalAccessException
NoSuchMethodException
InvocationTargetException
InstantiationException
-
getDeclaredFields
-
buildDeclaredFields
-