com.googlecode.entreri.property.PropertyFactory Maven / Gradle / Ivy
/*
* Entreri, an entity-component framework in Java
*
* Copyright (c) 2011, Michael Ludwig
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.googlecode.entreri.property;
/**
*
* A PropertyFactory is a simple factory that can be used to create Property
* instances if the Property requires a more complicated constructor than can be
* described by the {@link Parameters} annotation on a Property field.
* Additionally, it is used when decorating a Component type in an EntitySystem
* to ensure that each decoration event gets a unique property instance.
*
*
* To be used with the {@link Factory} when defining a Component type, the
* PropertyFactory must have an accessible, no-argument constructor.
*
*
* @author Michael Ludwig
* @param The Property type created
*/
public interface PropertyFactory {
/**
* Return a new Property instance. This must be a new instance that has not
* been returned previously or the entity framework will have undefined
* behavior.
*
* @return A new Property of type T
*/
public T create();
}