private MethodMetadataBuilder getCreateMethod(String declaredById, JavaType targetType) {
   InvocableMemberBodyBuilder invocableMemberBodyBuilder =
       InvocableMemberBodyBuilder.getInstance();
   invocableMemberBodyBuilder.append("return new " + targetType.getSimpleTypeName() + "();");
   MethodMetadataBuilder createMethodBuilder =
       new MethodMetadataBuilder(
           declaredById,
           Modifier.PUBLIC,
           new JavaSymbolName("create"),
           targetType,
           invocableMemberBodyBuilder);
   JavaType wildEntityType =
       new JavaType(
           targetType.getFullyQualifiedTypeName(),
           0,
           DataType.VARIABLE,
           JavaType.WILDCARD_EXTENDS,
           null);
   JavaType classParameterType =
       new JavaType(
           JavaType.CLASS.getFullyQualifiedTypeName(),
           0,
           DataType.TYPE,
           null,
           Arrays.asList(wildEntityType));
   createMethodBuilder.addParameter("clazz", classParameterType);
   return createMethodBuilder;
 }
 private MethodMetadataBuilder getFindMethod(
     ClassOrInterfaceTypeDetailsBuilder locatorBuilder,
     String declaredById,
     JavaType targetType,
     JavaType idType) {
   MemberTypeAdditions findMethodAdditions =
       layerService.getMemberTypeAdditions(
           declaredById,
           PersistenceCustomDataKeys.FIND_METHOD.name(),
           targetType,
           idType,
           LAYER_POSITION,
           new MethodParameter(idType, "id"));
   InvocableMemberBodyBuilder invocableMemberBodyBuilder =
       InvocableMemberBodyBuilder.getInstance();
   invocableMemberBodyBuilder
       .append("return ")
       .append(findMethodAdditions.getMethodCall())
       .append(";");
   findMethodAdditions.copyAdditionsTo(locatorBuilder, locatorBuilder.build());
   MethodMetadataBuilder findMethodBuilder =
       new MethodMetadataBuilder(
           declaredById,
           Modifier.PUBLIC,
           new JavaSymbolName("find"),
           targetType,
           invocableMemberBodyBuilder);
   JavaType wildEntityType =
       new JavaType(
           targetType.getFullyQualifiedTypeName(),
           0,
           DataType.VARIABLE,
           JavaType.WILDCARD_EXTENDS,
           null);
   JavaType classParameterType =
       new JavaType(
           JavaType.CLASS.getFullyQualifiedTypeName(),
           0,
           DataType.TYPE,
           null,
           Arrays.asList(wildEntityType));
   findMethodBuilder.addParameter("clazz", classParameterType);
   findMethodBuilder.addParameter("id", idType);
   return findMethodBuilder;
 }
 private MethodMetadataBuilder getDomainTypeMethod(String declaredById, JavaType targetType) {
   InvocableMemberBodyBuilder invocableMemberBodyBuilder =
       InvocableMemberBodyBuilder.getInstance();
   invocableMemberBodyBuilder.append("return " + targetType.getSimpleTypeName() + ".class;");
   JavaType returnType =
       new JavaType(
           JavaType.CLASS.getFullyQualifiedTypeName(),
           0,
           DataType.TYPE,
           null,
           Arrays.asList(targetType));
   return new MethodMetadataBuilder(
       declaredById,
       Modifier.PUBLIC,
       new JavaSymbolName("getDomainType"),
       returnType,
       invocableMemberBodyBuilder);
 }