001package com.avaje.ebean.config; 002 003/** 004 * API from creating and getting property values from an Immutable Compound 005 * Value Object. 006 * 007 * <p> 008 * A Compound Value object should contain multiple properties that are stored 009 * separately. If you only have a single scalar value you should instead look to 010 * use {@link ScalarTypeConverter}. 011 * </p> 012 * <p> 013 * For each property in the compound type you need to implement the 014 * {@link CompoundTypeProperty} interface. These must be returned from 015 * {@link #getProperties()} in the same order that the properties appear in the 016 * constructor. 017 * </p> 018 * <p> 019 * If your compound type is mutable then you should look to use the JPA Embedded 020 * annotation instead of implementing this interface. 021 * </p> 022 * <p> 023 * When using classpath search Ebean will detect and automatically register any 024 * implementations of this interface (along with detecting the entity classes 025 * etc). 026 * </p> 027 * 028 * @author rbygrave 029 * 030 * @param <V> 031 * The type of the Value Object 032 * 033 * @see ScalarTypeConverter 034 */ 035public interface CompoundType<V> { 036 037 /** 038 * Create an instance of the compound type given its property values. 039 */ 040 V create(Object[] propertyValues); 041 042 /** 043 * Return the properties in the order they appear in the constructor. 044 */ 045 CompoundTypeProperty<V, ?>[] getProperties(); 046}