use of org.apache.bcel.classfile.FieldOrMethod in project fb-contrib by mebigfatguy.
the class JPAIssues method catalogFieldOrMethod.
/**
* parses a field or method for spring-tx or jpa annotations
*
* @param fm
* the currently parsed field or method
*/
private void catalogFieldOrMethod(FieldOrMethod fm) {
for (AnnotationEntry entry : fm.getAnnotationEntries()) {
String type = entry.getAnnotationType();
switch(type) {
case "Lorg/springframework/transaction/annotation/Transactional;":
if (fm instanceof Method) {
boolean isWrite = true;
for (ElementValuePair pair : entry.getElementValuePairs()) {
if ("readOnly".equals(pair.getNameString())) {
isWrite = "false".equals(pair.getValue().stringifyValue());
break;
}
}
transactionalMethods.put(new FQMethod(cls.getClassName(), fm.getName(), fm.getSignature()), isWrite ? TransactionalType.WRITE : TransactionalType.READ);
}
break;
case "Ljavax/persistence/Id;":
hasId = true;
break;
case "Ljavax/persistence/GeneratedValue;":
hasGeneratedValue = true;
break;
case "Ljavax/persistence/OneToMany;":
for (ElementValuePair pair : entry.getElementValuePairs()) {
if ("fetch".equals(pair.getNameString()) && "EAGER".equals(pair.getValue().stringifyValue())) {
hasEagerOneToMany = true;
break;
}
}
break;
case "Lorg/hibernate/annotations/Fetch;":
case "Lorg/eclipse/persistence/annotations/JoinFetch;":
case "Lorg/eclipse/persistence/annotations/BatchFetch;":
hasFetch = true;
break;
default:
break;
}
}
}
Aggregations