dto-mappers
БесплатноБез исполняемых скриптовНе проверенDTO and mapper patterns for Xeres using Java records, canonical constructors with validation, and static mapper utility classes.
от zapek★ 224 звезды на GitHubОб этом скилле
DTO and Mapper Patterns for Xeres
DTOs as Records
Use Java records for immutable DTOs:
public record ProfileDTO(
long id,
@NotNull @Size String name,
String pgpIdentifier,
Instant created,
byte[] pgpFingerprint,
byte[] pgpPublicKeyData,
boolean accepted,
Trust trust,
@JsonInclude(NON_EMPTY) List<LocationDTO> locations
)
{
public ProfileDTO
{
if (locations == null) locations = new ArrayList<>();
}
}
Canonical Constructor with Validation
public record ProfileDTO(String name, List<Location> locations)
{
public ProfileDTO
{
Objects.requireNonNull(name, "Name must not be null");
if (locations == null)
{
locations = new ArrayList<>();
}
locations = List.copyOf(locations); // Make immutable
}
}
Mapper Pattern
Static utility class with mapping methods:
public final class ProfileMapper
{
private ProfileMapper()
{
throw new UnsupportedOperationException("Utility class");
}
public static ProfileDTO toDTO(Profile profile)
{
if (profile == null)
{
return null;
}
return new ProfileDTO(
profile.getId(),
profile.getName());
// ... other fields
}
public static Profile toEntity(ProfileDTO dto)
{
if (dto == null)
{
return null;
}
var profile = new Profile();
profile.setId(dto.id());
profile.setName(dto.name());
// ... other fields
return profile;
}
}
Usage
// Entity to DTO
ProfileDTO dto = ProfileMapper.toDTO(profile);
// DTO to Entity
Profile profile = ProfileMapper.toEntity(dto);
// List mapping
List<ProfileDTO> dtos = profiles.stream()
.map(ProfileMapper::toDTO)
.toList();
JsonInclude for Optional Fields
@JsonInclude(NON_EMPTY) // Don't serialize null or empty collections
List<LocationDTO> locations;
Validation Annotations
Use Bean Validation on DTO fields:
@NotNull
@Size(min = 1, max = 255)
String name;
@Email
String email;
@Min(0)
@Max(100)
int percentage;
Collection Handling
Always handle null collections in constructor:
public ProfileDTO
{
if (locations == null)
{
locations = new ArrayList<>();
}
}
Установить dto-mappers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dto-mappers?
DTO and mapper patterns for Xeres using Java records, canonical constructors with validation, and static mapper utility classes.
Как установить скилл dto-mappers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dto-mappers запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic