if (accessor.getAccessMethods() != null) {
// Can't rely on MappingAccessor's getGetMethodName
// methods as they could result in NPE if
// accessibleObject isn't set first
String getMethodName = accessor.getAccessMethods().getGetMethodName();
MetadataMethod getMethod = getJavaClass().getMethod(getMethodName, new String[]{});
String setMethodName = accessor.getAccessMethods().getSetMethodName();
MetadataMethod setMethod = getJavaClass().getMethod(setMethodName, Arrays.asList(new String[]{getMethod.getReturnType()}));
getMethod.setSetMethod(setMethod);
accessibleObject = getMethod;
} else {
MetadataMethod method = getJavaClass().getMethodForPropertyName(accessor.getName());
if (method == null) {
throw ValidationException.invalidPropertyForClass(accessor.getName(), getJavaClass());
} else {
// True will force an exception to be thrown if it
// is not a valid method. However, if it is a
// transient accessor, don't validate it and just
// let it through.
if (accessor.isTransient() || method.isValidPersistenceMethod(getDescriptor(), true)) {
accessibleObject = method;
}
}
}
} else {