Class BeanMethodContainer

java.lang.Object
io.github.mmm.bean.generator.BeanMethodContainer
Direct Known Subclasses:
BeanMethodContainerGetter, BeanMethodContainerProperty, BeanMethodContainerSetter

public abstract class BeanMethodContainer extends Object
Wrapper for a Method of a WritableBean.
Since:
1.0.0
  • Field Details

  • Constructor Details

    • BeanMethodContainer

      public BeanMethodContainer(Method method, String propertyName)
      The constructor.
      Parameters:
      method - the method.
      propertyName - the property name.
  • Method Details

    • write

      public void write(Writer writer) throws IOException
      Writes the method.
      Parameters:
      writer - the Writer.
      Throws:
      IOException - on error.
    • writeParameters

      protected void writeParameters(Writer writer) throws IOException
      Writes the method parameters.
      Parameters:
      writer - the Writer.
      Throws:
      IOException - on error.
    • writeBody

      protected abstract void writeBody(Writer writer) throws IOException
      Writes the method body (implementation).
      Parameters:
      writer - the Writer.
      Throws:
      IOException - on error.
    • getMethod

      public Method getMethod()
      Returns:
      the underlying bean Method.
    • getPropertyName

      public String getPropertyName()
      Returns:
      property the name of the property handled by this method.
    • getParameterName

      public String getParameterName()
      Returns:
      property the name of the property handled by this method.
    • getPropertyType

      public abstract Class<?> getPropertyType()
      Returns:
      the Class reflecting the {ReadablePropertytype of the property value (and not the property itself).
    • of

      public static BeanMethodContainer of(Method method)
      Parameters:
      method - the Method to introspect.
      Returns:
      the corresponding BeanMethodContainer or null if not a BeanMethodContainer (to implement).
    • isSpecialized

      public boolean isSpecialized(BeanMethodContainer other)
      Parameters:
      other - the BeanMethodContainer to compare.
      Returns:
      true if this BeanMethodContainer is more specialized than the given one (e.g. it overrides the given method), false otherwise.