public byte[] readFileContents(Object fileNameContainer) {
Method method = fileNameContainer
.getClass()
.getMethod("getFileName", null);
String fileName = method.invoke(fileNameContainer, null);
// dependencies on concrete methods or fields of an object
}