com.scooterframework.orm.activerecord
Class Category

java.lang.Object
  extended by com.scooterframework.orm.activerecord.Category

public class Category
extends java.lang.Object

Category class holds information about a category of entities.


Constructor Summary
Category(java.lang.Class<? extends ActiveRecord> center, java.lang.String category, java.lang.String idField, java.lang.String typeField)
          Creates a Category instance.
 
Method Summary
 void addEntity(java.lang.String type, java.lang.String entity)
          Adds type and its corresponding entity name to a map.
 java.lang.String getCategory()
          Returns category.
 java.lang.Class<? extends ActiveRecord> getCenterClass()
          Returns center class of the category.
 java.lang.String getEntityByType(java.lang.String type)
          Returns entity.
 java.util.Set<java.lang.String> getEntitys()
          Returns all entity names.
 java.lang.String getIdField()
          Returns idField.
 java.lang.String getTypeByEntity(java.lang.String entity)
          Returns type name for the entity.
 java.lang.String getTypeField()
          Returns typeField.
 java.util.Set<java.lang.String> getTypes()
          Returns all type names.
 boolean isEntityInCategory(java.lang.String entity)
          Checks if an entity is in the category.
 boolean isTypeInCategory(java.lang.String type)
          Checks if an entity type is in the category.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Category

public Category(java.lang.Class<? extends ActiveRecord> center,
                java.lang.String category,
                java.lang.String idField,
                java.lang.String typeField)
Creates a Category instance.

Parameters:
center - center class of the category
category - category name
idField - id field name for the category
typeField - type field name for the category
Method Detail

getCenterClass

public java.lang.Class<? extends ActiveRecord> getCenterClass()
Returns center class of the category.

Returns:
center class of the category.

addEntity

public void addEntity(java.lang.String type,
                      java.lang.String entity)
Adds type and its corresponding entity name to a map.

Parameters:
type -
entity -

getEntityByType

public java.lang.String getEntityByType(java.lang.String type)
Returns entity.

Parameters:
type - type name of an entity
Returns:
entity

getEntitys

public java.util.Set<java.lang.String> getEntitys()
Returns all entity names.

Returns:
set of entity names

isEntityInCategory

public boolean isEntityInCategory(java.lang.String entity)
Checks if an entity is in the category.

Parameters:
entity - the entity to check
Returns:
true if the entity is in the category

isTypeInCategory

public boolean isTypeInCategory(java.lang.String type)
Checks if an entity type is in the category.

Parameters:
type - the entity type to check
Returns:
true if the entity is in the category

getTypeByEntity

public java.lang.String getTypeByEntity(java.lang.String entity)
Returns type name for the entity.

Returns:
type name for the entity

getTypes

public java.util.Set<java.lang.String> getTypes()
Returns all type names.

Returns:
set of type names

getCategory

public java.lang.String getCategory()
Returns category.

Returns:
category

getIdField

public java.lang.String getIdField()
Returns idField.

Returns:
idField

getTypeField

public java.lang.String getTypeField()
Returns typeField.

Returns:
typeField