code: public Criteria example(Criteria criteria, T example, Attribute<T, ?>... usingAttributes) {
  
          if (criteria == null) {
              criteria = criteria();
          }
  
          if (usingAttributes == null || usingAttributes.length == 0) {
              throw new RuntimeException("Please provide attributes to example criteria.");
          }
  
          for (Attribute<T, ?> usingAttribute : usingAttributes) {
              if (usingAttribute instanceof SingularAttribute) {
                  addEqExampleRestriction(criteria, example, usingAttribute);
              } else if (usingAttribute instanceof PluralAttribute) {
                  addInExampleRestriction(criteria, example, usingAttribute);
              }
  
          }
  
          return criteria;
      }
docs: This example criteria will add restrictions to an existing criteria based on an example entity. It will use <code>eq</code> for comparing 'simple' attributes,
  for <code>oneToOne</code> associations the entity PK will be compared and for oneToMany association an <code>in</code> for comparing associated entities PKs
  
  @param criteria        a criteria to add restrictions based on the example entity.
  @param example         An entity whose attribute's value will be used for creating a criteria
  @param usingAttributes attributes from example entity to consider.
  @return A criteria restricted by example.
  @throws RuntimeException If no attribute is provided.