Skip to content

laboratoriobridge/metafy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov Maven Central

Metafy

Generate meta information for Java objects.

Usage

Mark your class with @Metafy:

import br.ufsc.bridge.metafy.Metafy;

@Metafy
class AuthorDto {
	private Long id;
	private String name;
}

This will generate:

import br.ufsc.bridge.metafy.MetaBean;
import br.ufsc.bridge.metafy.MetaField;

public class MAuthorDto extends MetaBean<AuthorDto> {

	public static final MAuthorDto meta = new MAuthorDto();

	public final MetaField<Long> id = createField(Long.class, "id");
	public final MetaField<String> name = createField(String.class, "name");


	public MAuthorDto() {
		super(AuthorDto.class);
	}

	public MAuthorDto(MetaBean<?> parent) {
		super(parent, AuthorDto.class);
	}

	public MAuthorDto(MetaBean<?> parent, String alias) {
		super(parent, AuthorDto.class, alias);
	}

}

To be used as:

MAuthorDto meta = MAuthorDto.meta;

meta.id; // meta information about id attribute
meta.name; // meta information about name attribute