Package org.apache.tapestry5.plastic

# Interface FieldValueProvider

public interface FieldValueProvider

Interface that can be implemented to provide access to field values based on their name. Usually implemented with PlasticUtils.implementFieldValueProvider(PlasticClass, java.util.Set), which doesn't use reflection.

The name of its abstract method is intended to avoid clashes with other existing methods in the class.

Since:
  5.8.4
See Also:
  - `PlasticUtils.implementFieldValueProvider(PlasticClass, java.util.Set)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `__fieldValueProvider__get(String fieldName)`
  Returns the value of a given field.
  `static Object`
  `get(Object object, String fieldName)`
  Returns the value of a given field in a given object if it belongs to a class that implements FieldValueProvider.

- ## Method Details

  - ### __fieldValueProvider__get

    Object __fieldValueProvider__get(String fieldName)
    Returns the value of a given field.
    Parameters:
      `fieldName` - the field name.
    Returns:
      the field value.

  - ### get

    static Object get(Object object, String fieldName)

    Returns the value of a given field in a given object if it belongs to a class that implements FieldValueProvider. Otherwise, it throws an exception.

    This is an utility method to avoid having to make casts very time you need to call __fieldValueProvider__get(String).

    Parameters:
      `object` - an object.
      `fieldName` - the field name.
    Returns:
      the field value.