Class UniquePropertyEntityConverter

java.lang.Object
org.fastnate.data.properties.UniquePropertyEntityConverter
All Implemented Interfaces:
PropertyConverter<Object>

public class UniquePropertyEntityConverter extends Object implements PropertyConverter<Object>
Uses the EntityRegistration to resolve entities by a specific unique property. If an entity has exactly one unique property, one can use DefaultEntityConverter instead. If an entity has no unique property or some other kind of key is used as reference in the CSV files, one can use MapConverter.
Author:
Tobias Liefke
  • Constructor Details

    • UniquePropertyEntityConverter

      public UniquePropertyEntityConverter(EntityRegistration entityRegistration, String uniqueProperty)
      Creates a new UniquePropertyEntityConverter instance.
      Parameters:
      entityRegistration - Used to find the entities.
      uniqueProperty - The name of the unique properties.
  • Method Details

    • convert

      public Object convert(Class<? extends Object> targetType, String value)
      Description copied from interface: PropertyConverter
      Converts a value from import file to Java.
      Specified by:
      convert in interface PropertyConverter<Object>
      Parameters:
      targetType - the type of the target property
      value - the value in the import file
      Returns:
      the value in Java