All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.ao.RelatedEntity Maven / Gradle / Ivy

Go to download

This is the full Active Objects library, if you don't know which one to use, you probably want this one.

There is a newer version: 6.1.1
Show newest version
/*
 * Copyright 2007 Daniel Spiewak
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at
 * 
 *	    http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.java.ao;

import net.java.ao.schema.Ignore;

/**
 * 

A superinterface for entities which are related to each other using * Lucene heuristics. This is not required as a superinterface * for entities related to one another at the database level. Thus, this * interface is only relevant to those already using full-text indexing.

* *

While this entity does not extend {@link RawEntity} itself, it should * only be inherited by interfaces which do. In fact, this is enforced by * the type parameterization of this interface. Example:

* *
public interface Post extends Entity, RelatedEntity<Post> {
 *     // ...
 *     
 *     @Searchable
 *     @SQLType(Types.BLOB)
 *     public String getBody();
 *     
 *     @Searchable
 *     @SQLType(Types.BLOB)
 *     public void setBody(String body);
 * }
 * 
 * // ...
 * Post p = manager.get(Post.class, 123);
 * Post[] relatedPosts = p.getRelated();      // searches Lucene index for related posts
* *

Under most circumstances, the type parameter used when * inheriting from this interface should be the entity interface itself, as * in the above example.

* * @author Daniel Spiewak * @see net.java.ao.SearchableEntityManager */ @Implementation(RelatedEntityImpl.class) public interface RelatedEntity & RawEntity> { /** * Retrieves the entities related to this by using full-text search * heuristics. No database invocation is involved in calling this * method. Also, the results are uncached, relying instead on the * underlying performance optimizations of Lucene itself. * * @return Any entities of the relevant type which relate to the current * instance in the full-text index. */ @Ignore public T[] getRelated(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy