Class BeanHelper

java.lang.Object
io.github.mmm.bean.BeanHelper

public class BeanHelper extends Object
Class with helper methods for internal reuse to avoid redundancies.
Since:
1.0.0
  • Constructor Details

    • BeanHelper

      public BeanHelper()
  • Method Details

    • copy

      public static void copy(AbstractBean source, AbstractBean target, boolean readOnly)
      Parameters:
      source - the source bean to copy from.
      target - the target bean to copy to.
      readOnly - - true if the copy shall be read-only, false otherwise.
      See Also:
    • copy

      public static <B extends WritableBean> void copy(B source, B target)
      Type Parameters:
      B - type of the bean to copy.
      Parameters:
      source - the source bean to copy from.
      target - the target bean to copy to.
      See Also:
    • copyUnsafe

      public static void copyUnsafe(ReadableBean source, WritableBean target)
      Parameters:
      source - the source bean to copy from.
      target - the target bean to copy to.
      See Also:
    • getPropertyName4Getter

      public static String getPropertyName4Getter(String getter)
      Parameters:
      getter - the name of a method that is potentially a getter.
      Returns:
      the property name for the given getter or null if not a getter.
    • getPropertyName4Setter

      public static String getPropertyName4Setter(String setter)
      Parameters:
      setter - the name of a method that is potentially a setter.
      Returns:
      the property name for the given setter or null if not a setter.
    • getPropertyName4Property

      public static String getPropertyName4Property(Method method)
      Parameters:
      method - the Method to check.
      Returns:
      the property name for the given Method or null if not a property Method.
    • getPropertyFactory

      public static PropertyFactory<?,?> getPropertyFactory(Class<?> type)
      Parameters:
      type - the Class reflecting the ReadableProperty to get the PropertyFactory for.
      Returns:
      the PropertyFactory for the given property Class or null if not a property.
    • getPropertyNames

      public static Set<String> getPropertyNames(ReadableBean bean)
      Parameters:
      bean - the ReadableBean.
      Returns:
      the Set with the names of the properties.