private Optional < Object > toStringOrEqualsOrHashCode ( String method , Class < ? > serviceInterface , Object ... args ) { switch ( method ) { case "toString" : return Optional . of ( serviceInterface . toString ( ) ) ; case "equals" : return Optional . of ( serviceInterface . equals ( args [ 0 ] ) ) ; case "hashCode" : return Optional . of ( serviceInterface . hashCode ( ) ) ; default : return Optional . empty ( ) ; } }
check and handle toString or equals or hashcode method where invoked .