Pattern i Matcher

public static List<String> find(String in, String pattern) {
List<String> list = new ArrayList<String>();
Pattern regex = Pattern.compile(pattern);
Matcher matcher = regex.matcher(in);
String s = null;
while(matcher.find()) {
s = matcher.group();
list.add(s);
}
return list;
}

Reklamy

GenericTypes

dla: public abstract class BaseService<DTO extends GenericDto<T>, T extends BaseEntity>

rozwiązanie 1:

public BaseService(Class<DTO> dtoClass, Class<T> jpaClass) {
super();
this.dtoClass = dtoClass;
this.jpaClass = jpaClass;
}

rozwiązanie 2:

(Class<DTO>)((ParameterizedType)superclass).getActualTypeArguments()[0];

(Class<T>)((ParameterizedType)superclass).getActualTypeArguments()[1];