/** * Gets a {@link BeanPropertySet} for the given bean type. * * @param beanType * the bean type to get a property set for, not <code>null</code> * @return the bean property set, not <code>null</code> */ @SuppressWarnings("unchecked") public static <T> PropertySet<T> get(Class<? extends T> beanType) { Objects.requireNonNull(beanType, "Bean type cannot be null"); InstanceKey key = new InstanceKey(beanType, false, 0, null); // Cache the reflection results return (PropertySet<T>) INSTANCES .computeIfAbsent(key, ignored -> new BeanPropertySet<>(key)) .copy(); }
/** * Gets a {@link BeanPropertySet} for the given bean type. * * @param beanType * the bean type to get a property set for, not <code>null</code> * @param checkNestedDefinitions * whether to scan for nested definitions in beanType * @param filterDefinition * filtering conditions for nested properties * @return the bean property set, not <code>null</code> * @since 8.2 */ @SuppressWarnings("unchecked") public static <T> PropertySet<T> get(Class<? extends T> beanType, boolean checkNestedDefinitions, PropertyFilterDefinition filterDefinition) { Objects.requireNonNull(beanType, "Bean type cannot be null"); InstanceKey key = new InstanceKey(beanType, false, filterDefinition.getMaxNestingDepth(), filterDefinition.getIgnorePackageNamesStartingWith()); return (PropertySet<T>) INSTANCES .computeIfAbsent(key, k -> new BeanPropertySet<>(key, checkNestedDefinitions, filterDefinition)) .copy(); }