Interface PropertyAccess

  • All Known Implementing Classes:
    PropertyAccessImpl

    public interface PropertyAccess
    A wrapper around the JavaBean Introspector that allows more manageable access to JavaBean properties of objects. Only provides access to simple properties. Indexed properties are ignored. Starting in Tapestry 5.2, public fields can now be accessed as if they were properly JavaBean properties. Where there is a name conflict, the true property will be favored over the field access.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearCache()
      Discards all stored property access information, discarding all created class adapters.
      java.lang.Object get​(java.lang.Object instance, java.lang.String propertyName)
      Reads the value of a property.
      ClassPropertyAdapter getAdapter​(java.lang.Class forClass)
      Returns the adapter used to access properties within the indicated class.
      ClassPropertyAdapter getAdapter​(java.lang.Object instance)
      Returns the adapter for a particular object instance.
      java.lang.annotation.Annotation getAnnotation​(java.lang.Object instance, java.lang.String propertyName, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
      Returns the annotation of a given property for the specified type if such an annotation is present, else null.
      void set​(java.lang.Object instance, java.lang.String propertyName, java.lang.Object value)
      Updates the value of a property.
    • Method Detail

      • get

        java.lang.Object get​(java.lang.Object instance,
                             java.lang.String propertyName)
        Reads the value of a property.
        Throws:
        java.lang.UnsupportedOperationException - if the property is write only
        java.lang.IllegalArgumentException - if property does not exist
      • set

        void set​(java.lang.Object instance,
                 java.lang.String propertyName,
                 java.lang.Object value)
        Updates the value of a property.
        Throws:
        java.lang.UnsupportedOperationException - if the property is read only
        java.lang.IllegalArgumentException - if property does not exist
      • getAnnotation

        java.lang.annotation.Annotation getAnnotation​(java.lang.Object instance,
                                                      java.lang.String propertyName,
                                                      java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
        Returns the annotation of a given property for the specified type if such an annotation is present, else null. A convenience over invoking getAdapter(Object).ClassPropertyAdapter.getPropertyAdapter(String).AnnotationProvider.getAnnotation(Class)
        Parameters:
        instance - the object to read a value from
        propertyName - the name of the property to read (case is ignored)
        annotationClass - the type of annotation to return
        Throws:
        java.lang.IllegalArgumentException - if property does not exist
        Since:
        5.4
      • clearCache

        void clearCache()
        Discards all stored property access information, discarding all created class adapters.