Class MarshalledFilter
- All Implemented Interfaces:
BeanFilter
Marshalled filters provide fine-grained control over how classes are processed, allowing you to:
- Specify which properties to include or exclude (for beans)
- Define read-only and write-only properties
- Control property ordering and naming
- Configure bean dictionaries for polymorphic types
- Intercept property getter and setter calls
- Define interface classes and stop classes for property filtering
- Specify implementation classes for interfaces and abstract classes
- Provide example instances for documentation
Marshalled filters are created using the MarshalledFilter.Builder class, which is the programmatic equivalent to the
@Marshalled annotation. Filters can be registered with serializers and parsers to customize
how specific classes are handled.
Example:
See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMarshalledFilter(MarshalledFilter.Builder builder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> MarshalledFilter.Buildercreate(ClassInfoTyped<T> beanClass) Create a new builder for this object for use with bean classes.Returns the bean class that this filter applies to.Returns the bean dictionary defined on this bean.Returns the example associated with this class.Returns the list of properties to ignore on a bean.Returns the implementation class associated with this class.Returns the interface class associated with this class.Returns the set and order of names of properties associated with a bean class.Returns thePropertyNamerassociated with the bean to tailor the names of bean properties.Returns the list of read-only properties on a bean.Returns the stop class associated with this class.Returns the dictionary name associated with this bean.Returns the list of write-only properties on a bean.booleanReturnstrue if we should find fluent setters.booleanReturnstrue if the properties defined on this bean class should be ordered alphabetically.readProperty(Object bean, String name, Object value) Calls theBeanInterceptor.readProperty(Object, String, Object)method on the registered property filters.writeProperty(Object bean, String name, Object value) Calls theBeanInterceptor.writeProperty(Object, String, Object)method on the registered property filters.
-
Constructor Details
-
MarshalledFilter
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
create
Create a new builder for this object for use with bean classes.- Type Parameters:
T- The bean class being filtered.- Parameters:
beanClass- The bean class being filtered.- Returns:
- A new builder.
-
getBeanClass
Returns the bean class that this filter applies to.- Specified by:
getBeanClassin interfaceBeanFilter- Returns:
- The bean class that this filter applies to, or
null if this is a non-bean filter.
-
getBeanDictionary
Returns the bean dictionary defined on this bean.- Specified by:
getBeanDictionaryin interfaceBeanFilter- Returns:
- An unmodifiable list of the bean dictionary defined on this bean, or an empty list if no bean dictionary is defined.
-
getExample
Returns the example associated with this class.- Specified by:
getExamplein interfaceBeanFilter- Returns:
- The example associated with this class, or
null if no example is associated.
-
getExcludeProperties
Returns the list of properties to ignore on a bean.- Specified by:
getExcludePropertiesin interfaceBeanFilter- Returns:
- The names of the properties to ignore on a bean, or an empty set to not ignore any properties.
-
getImplClass
Returns the implementation class associated with this class.- Specified by:
getImplClassin interfaceBeanFilter- Returns:
- The implementation class associated with this class, or
null if no implementation class is associated.
-
getInterfaceClass
Returns the interface class associated with this class.- Specified by:
getInterfaceClassin interfaceBeanFilter- Returns:
- The interface class associated with this class, or
null if no interface class is associated.
-
getProperties
Returns the set and order of names of properties associated with a bean class.- Specified by:
getPropertiesin interfaceBeanFilter- Returns:
- The names of the properties associated with a bean class, or an empty set if all bean properties should be used.
-
getPropertyNamer
Returns thePropertyNamerassociated with the bean to tailor the names of bean properties.- Specified by:
getPropertyNamerin interfaceBeanFilter- Returns:
- The property namer class, or
null if no property namer is associated with this bean property.
-
getReadOnlyProperties
Returns the list of read-only properties on a bean.- Specified by:
getReadOnlyPropertiesin interfaceBeanFilter- Returns:
- The names of the read-only properties on a bean, or an empty set to not have any read-only properties.
-
getStopClass
Returns the stop class associated with this class.- Specified by:
getStopClassin interfaceBeanFilter- Returns:
- The stop class associated with this class, or
null if no stop class is associated.
-
getTypeName
Returns the dictionary name associated with this bean.- Specified by:
getTypeNamein interfaceBeanFilter- Returns:
- The dictionary name associated with this bean, or
null if no name is defined.
-
getWriteOnlyProperties
Returns the list of write-only properties on a bean.- Specified by:
getWriteOnlyPropertiesin interfaceBeanFilter- Returns:
- The names of the write-only properties on a bean, or an empty set to not have any write-only properties.
-
isFluentSetters
Returnstrue if we should find fluent setters.- Specified by:
isFluentSettersin interfaceBeanFilter- Returns:
true if fluent setters should be found.
-
isUnsortedProperties
Returnstrue if the properties defined on this bean class should be ordered alphabetically.This method is only used when the
getProperties()method returns an empty set. Otherwise, the ordering of the properties in the returned value is used.- Specified by:
isUnsortedPropertiesin interfaceBeanFilter- Returns:
true if this bean opts out of alphabetical property sorting.
-
readProperty
Calls theBeanInterceptor.readProperty(Object, String, Object)method on the registered property filters.- Specified by:
readPropertyin interfaceBeanFilter- Parameters:
bean- The bean from which the property was read.name- The property name.value- The value just extracted from calling the bean getter.- Returns:
- The value to serialize. Default is just to return the existing value.
-
writeProperty
Calls theBeanInterceptor.writeProperty(Object, String, Object)method on the registered property filters.- Specified by:
writePropertyin interfaceBeanFilter- Parameters:
bean- The bean from which the property was read.name- The property name.value- The value just parsed.- Returns:
- The value to serialize. Default is just to return the existing value.
-