Package com.helger.commons.type
Class TypedObject<IDTYPE>
java.lang.Object
com.helger.commons.type.TypedObject<IDTYPE>
- Type Parameters:
IDTYPE- The type of the ID.
- All Implemented Interfaces:
IHasID<IDTYPE>,IHasObjectType,ITypedObject<IDTYPE>
Base implementation of an object that has an
This class is immutable if the type of the ID is immutable.
ObjectType and an ID.
This class is immutable if the type of the ID is immutable.
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionTypedObject(ITypedObject<IDTYPE> aObj) TypedObject(ObjectType aObjectType, IDTYPE aID) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <IDTYPE> TypedObject<IDTYPE> create(ITypedObject<IDTYPE> aObj) Factory methodstatic <IDTYPE> TypedObject<IDTYPE> create(ObjectType aObjectType, IDTYPE aID) Factory methodbooleangetID()Get the unique ID of this object.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.type.IHasObjectType
getObjectTypeName, hasObjectType
-
Constructor Details
-
TypedObject
- Parameters:
aObj- The typed object to copy the stuff from. May not benull.
-
TypedObject
Constructor.- Parameters:
aObjectType- Object type to use. May not benull.aID- ID to be used. May not benull.
-
-
Method Details
-
getObjectType
- Specified by:
getObjectTypein interfaceIHasObjectType- Returns:
- The type of the object. Never
null.
-
getID
Description copied from interface:IHasIDGet the unique ID of this object. If the type isStringthan the returned value must match an XML NMToken expression (so e.g. no ':' in the ID)! -
equals
-
hashCode
public int hashCode() -
toString
-
create
Factory method- Type Parameters:
IDTYPE- The type of the ID.- Parameters:
aObj- The typed object to copy the stuff from. May not benull.- Returns:
- new
TypedObject
-
create
@Nonnull public static <IDTYPE> TypedObject<IDTYPE> create(@Nonnull ObjectType aObjectType, @Nonnull IDTYPE aID) Factory method- Type Parameters:
IDTYPE- The type of the ID.- Parameters:
aObjectType- Object type to use. May not benull.aID- ID to be used. May not benull.- Returns:
- new
TypedObject
-