io.github.mmm.entity.property.id.FkProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mmm-entity-bean Show documentation
Show all versions of mmm-entity-bean Show documentation
Entity as Bean with Property support (IdProperty, LinkProperty, LinkListProperty).
The newest version!
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.entity.property.id;
import io.github.mmm.entity.bean.EntityBean;
import io.github.mmm.entity.id.Id;
import io.github.mmm.entity.id.FkMapper;
import io.github.mmm.property.PropertyMetadata;
import io.github.mmm.value.converter.TypeMapper;
/**
* {@link IdProperty} for a foreign key to another entity.
*
* @param type of the referenced {@link EntityBean}.
* @since 1.0.0
*/
public class FkProperty extends IdProperty> {
private TypeMapper, ?> typeMapper;
/**
* The constructor.
*
* @param name the {@link #getName() name}.
* @param id the initial {@link #get() value}.
* @param metadata the {@link #getMetadata() metadata}.
*/
public FkProperty(String name, Id id, PropertyMetadata> metadata) {
super(name, id, metadata);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public TypeMapper, ?> getTypeMapper() {
if (this.typeMapper == null) {
this.typeMapper = (TypeMapper) FkMapper.of(get());
}
return this.typeMapper;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy