public Object getNewSingleFieldIdentity(Class idType, Class pcType, Object value)
{
// TODO Use JPOX-internal SingleFieldIdentity
if (idType == null)
{
throw new JPOXException(LOCALISER.msg("029001", pcType)).setFatal();
}
if (pcType == null)
{
throw new JPOXException(LOCALISER.msg("029000", idType)).setFatal();
}
if (value == null)
{
throw new JPOXException(LOCALISER.msg("029003", idType, pcType)).setFatal();
}
if (!SingleFieldIdentity.class.isAssignableFrom(idType))
{
throw new JPOXException(LOCALISER.msg("029002", idType.getName(), pcType.getName())).setFatal();
}
SingleFieldIdentity id = null;
Class keyType = null;
if (idType == LongIdentity.class)
{
keyType = Long.class;
if (!(value instanceof Long))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "Long")).setFatal();
}
}
else if (idType == IntIdentity.class)
{
keyType = Integer.class;
if (!(value instanceof Integer))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "Integer")).setFatal();
}
}
else if (idType == StringIdentity.class)
{
keyType = String.class;
if (!(value instanceof String))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "String")).setFatal();
}
}
else if (idType == ByteIdentity.class)
{
keyType = Byte.class;
if (!(value instanceof Byte))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "Byte")).setFatal();
}
}
else if (idType == ShortIdentity.class)
{
keyType = Short.class;
if (!(value instanceof Short))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "Short")).setFatal();
}
}
else if (idType == CharIdentity.class)
{
keyType = Character.class;
if (!(value instanceof Character))
{
throw new JPOXException(LOCALISER.msg("029004", idType.getName(),
pcType.getName(), value.getClass().getName(), "Character")).setFatal();
}
}
else
{