Atavism Version 2018.1AGIS API

atavism.server.objects
Class ObjectType

java.lang.Object
  extended by atavism.server.objects.ObjectType
All Implemented Interfaces:
Marshallable, java.io.Serializable

public class ObjectType
extends java.lang.Object
implements java.io.Serializable, Marshallable

Atavism object type. Classifies Entity and AOObject objects by their basic type. ObjectTypes have a string name and a short id. The name and id must be unique. All plugins must use the same names and ids.

Object types may have one or more "base types". The base types are BASE_STRUCTURE, BASE_MOB, and BASE_PLAYER. Methods isStructure(), isMob(), and isPlayer() reflect the base type.

Applications should use the ObjectTypes defined in ObjectTypes rather than defining their own.

Applications create ObjectTypes using intern(). Multiple calls to intern() in the same process with the same parameters will return the same instance.

See Also:
Serialized Form

Nested Class Summary
static class ObjectType.PersistenceDelegate
          Internal use only.
 
Field Summary
static int BASE_MOB
          Mob base type.
static int BASE_PLAYER
          Player base type.
static int BASE_STRUCTURE
          Structure base type.
 
Constructor Summary
ObjectType()
          No-arg constructor required for marshalling.
 
Method Summary
 int getBaseType()
          Get the object base type.
static ObjectType getObjectType(short typeId)
          Get object type.
static ObjectType getObjectType(java.lang.String typeName)
          Get object type.
 short getTypeId()
          Get the object type number.
 java.lang.String getTypeName()
          Get the object type name.
static ObjectType intern(short typeId, java.lang.String typeName)
          Get or create an ObjectType.
static ObjectType intern(short typeId, java.lang.String typeName, int baseType)
          Get or create an ObjectType.
 boolean isA(ObjectType objectType)
          True if object type is a given object type, or object base type 'is a' given ObjectType.
 boolean isMob()
          True if object base type is a mob.
 boolean isPlayer()
          True if object base type is a player.
 boolean isStructure()
          True if object base type is a structure.
 void marshalObject(AOByteBuffer buf)
          Internal use only.
 java.lang.String toString()
           
 java.lang.Object unmarshalObject(AOByteBuffer buf)
          Internal use only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BASE_STRUCTURE

public static final int BASE_STRUCTURE
Structure base type.

See Also:
Constant Field Values

BASE_MOB

public static final int BASE_MOB
Mob base type.

See Also:
Constant Field Values

BASE_PLAYER

public static final int BASE_PLAYER
Player base type.

See Also:
Constant Field Values
Constructor Detail

ObjectType

public ObjectType()
No-arg constructor required for marshalling.

Method Detail

intern

public static ObjectType intern(short typeId,
                                java.lang.String typeName)
Get or create an ObjectType. Multiple calls to intern() in the same process with the same parameters will return the same instance.

Parameters:
typeId - Unique type number.
typeName - Unique type name.

intern

public static ObjectType intern(short typeId,
                                java.lang.String typeName,
                                int baseType)
Get or create an ObjectType. Multiple calls to intern() in the same process with the same parameters will return the same instance.

Parameters:
typeId - Unique type number.
typeName - Unique type name.
baseType - Bitwise OR of BASE_STRUCTURE, BASE_MOB, and BASE_PLAYER.

getObjectType

public static ObjectType getObjectType(short typeId)
Get object type.

Returns:
null if typeId does not exist (use intern() to create the object type.)

getObjectType

public static ObjectType getObjectType(java.lang.String typeName)
Get object type.

Returns:
null if typeName does not exist (use intern() to create the object type.)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTypeId

public short getTypeId()
Get the object type number.


getTypeName

public java.lang.String getTypeName()
Get the object type name.


isStructure

public boolean isStructure()
True if object base type is a structure.


isA

public boolean isA(ObjectType objectType)
True if object type is a given object type, or object base type 'is a' given ObjectType.


isMob

public boolean isMob()
True if object base type is a mob.


isPlayer

public boolean isPlayer()
True if object base type is a player.


getBaseType

public int getBaseType()
Get the object base type.


marshalObject

public void marshalObject(AOByteBuffer buf)
Internal use only.

Specified by:
marshalObject in interface Marshallable
Parameters:
buf - The byte buffer

unmarshalObject

public java.lang.Object unmarshalObject(AOByteBuffer buf)
Internal use only.

Specified by:
unmarshalObject in interface Marshallable


Copyright © 2018 Dragonsan Studios Sp. z o.o.