Entity.java :  » Google-tech » appengine-catfish » com » namazustudios » catfish » annotation » Java Open Source

Java Open Source » Google tech » appengine catfish 
appengine catfish » com » namazustudios » catfish » annotation » Entity.java
/*
 * This file is part of Catfish.
 * Copyright (C) 2010 Namazu Studios LLC
 * 
 * Catfish is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version.
 * 
 * Catfish is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with Catfish.  If not, please visit:
 *  
 * http://www.gnu.org/licenses/
 *  
 */
package com.namazustudios.catfish.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that the given type is to be stored as an entity in the app engine
 * datastore. When storing objects, it walks the entire inheritance hierarchy
 * for a class, however it stores only one object of the kind stored.
 * 
 * For instance, if you have... 
 * <code>
 * class Foo {}
 * 
 * @Entity class Bar extends Foo {} 
 * </code> 
 * 
 * Bar will inherit all of Foo's field when stored but it will be stored as a 
 * Bar kind of object meaning that you will not find the object as a Foo in
 * the datastore.
 * 
 * @author patricktwohig
 * 
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Entity {

  /**
   * The Kind of object. If left unspecified, this defaults to the simple name
   * of the annotated type.
   * 
   * @return the kind of data to store
   */
  public String kind() default "";

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.