1

I can not to find class ShowcasesUtil, that is use to filters, sorting of PrimeFaces LazySorting, LazyFiltering. Example below:

public int compare(Customer customer1, Customer customer2) {
 try {
 Object value1 = ShowcaseUtil.getPropertyValueViaReflection(customer1, sortField);
 Object value2 = ShowcaseUtil.getPropertyValueViaReflection(customer2, sortField);
 int value = ((Comparable) value1).compareTo(value2);
 return SortOrder.ASCENDING.equals(sortOrder) ? value : -1 * value;
 }
 catch (Exception e) {
 throw new RuntimeException(e);
 }
 }

Found information that it is a part of PrimeFaces Extensions: primefaces.extension.showcase. I try with 11.0.6 but still can not find this class in package. How to use it?

I try find it in PrimeFaces Extensions showcase 11.0.6.

seenukarthi
8,80310 gold badges51 silver badges75 bronze badges
asked Mar 19, 2023 at 12:52
2
  • This one? Commented Mar 19, 2023 at 16:06
  • No, I check this before. There is no method: getPropertyValueViaReflection. That is the main issue that I have with this Class Commented Mar 19, 2023 at 16:10

1 Answer 1

2

Just look in the PrimeFaces GitHub repository. You can find the file in both the 11.0.0 tag and the 12.0.0 tag:

https://github.com/primefaces/primefaces/blob/12.0.0/primefaces-showcase/src/main/java/org/primefaces/showcase/util/ShowcaseUtil.java This is the method:

public static final Object getPropertyValueViaReflection(Object o, String field)
 throws ReflectiveOperationException, IllegalArgumentException, IntrospectionException {
 return new PropertyDescriptor(field, o.getClass()).getReadMethod().invoke(o);
}

You can simply copy it to your project.

answered Mar 19, 2023 at 17:52
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.