Skip to content

OpenPojo should support JDK record objects. #151

@scottresnik

Description

@scottresnik

With the following validator:

		Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
				.with(new SetterTester()).with(new GetterTester()).build();
		validator.validate(PojoClassFactory.getPojoClasses(getClass().getPackageName()));

This class passes:

public class SimpleClass {
	private final String message;
	private final List<String> values;

	public SimpleClass(String message, List<String> values) {
		this.message = message;
		this.values = values;
	}

	public String getMessage() {
		return message;
	}

	public List<String> getValues() {
		return values;
	}
}

This similar record fails:

public record SimpleRecord(String message, List<String> values){}

A simple workaround is the following filter: pojoClass -> !pojoClass.getClazz().isRecord() .

It would be nice to have an isRecord() method on the PojoClass interface as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions