/** * Accessor for the key object for the specified single field application-identity. * @param id The identity * @return The key object */ public Object getTargetKeyForSingleFieldIdentity(Object id) { // TODO Use JPOX-internal SingleFieldIdentity if (id instanceof SingleFieldIdentity) { return ((SingleFieldIdentity)id).getKeyAsObject(); } return null; }
/** * Accessor for the target class for the specified single field application-identity. * @param id The identity * @return The target class */ public Class getTargetClassForSingleFieldIdentity(Object id) { // TODO Use JPOX-internal SingleFieldIdentity if (id instanceof SingleFieldIdentity) { return ((SingleFieldIdentity)id).getTargetClass(); } return null; }
/** * Accessor for the target class name for the specified single field identity. * @param id The identity * @return The target class name */ public String getTargetClassNameForSingleFieldIdentity(Object id) { // TODO Use JPOX-internal SingleFieldIdentity if (id instanceof SingleFieldIdentity) { return ((SingleFieldIdentity)id).getTargetClassName(); } return null; }
public static SingleFieldId getDataNucleusIdentityForSingleFieldIdentity(SingleFieldIdentity sfid) { if (sfid instanceof javax.jdo.identity.LongIdentity) { return new LongId(sfid.getTargetClass(), sfid.toString()); } else if (sfid instanceof javax.jdo.identity.IntIdentity) { return new IntId(sfid.getTargetClass(), sfid.toString()); } else if (sfid instanceof javax.jdo.identity.ShortIdentity) { return new ShortId(sfid.getTargetClass(), sfid.toString()); } else if (sfid instanceof javax.jdo.identity.ByteIdentity) { return new ByteId(sfid.getTargetClass(), sfid.toString()); } else if (sfid instanceof javax.jdo.identity.StringIdentity) { return new StringId(sfid.getTargetClass(), sfid.toString()); } else if (sfid instanceof javax.jdo.identity.CharIdentity) { return new CharId(sfid.getTargetClass(), sfid.toString()); } return new ObjectId(sfid.getTargetClass(), sfid.getKeyAsObject()); }
/** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); keyAsObject = (String)in.readObject(); } }
/** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeObject(keyAsObject); }
/** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { ShortIdentity other = (ShortIdentity) obj; return key == other.key; } }
/** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof ByteIdentity) { ByteIdentity other = (ByteIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); }
/** Return the key as an Object. The method is synchronized to avoid * race conditions in multi-threaded environments. * @return the key as an Object. * @since 2.0 */ public synchronized Object getKeyAsObject() { if (keyAsObject == null) { keyAsObject = createKeyAsObject(); } return keyAsObject; }
/** Construct this instance with the key value. */ private void construct(byte key) { this.key = key; hashCode = super.hashClassName() ^ key; }
/** Set the given key as the key for this instance. * Compute the hash code for the instance. * @since 2.0 */ protected void setKeyAsObject(Object key) { assertKeyNotNull(key); keyAsObject = key; }
JavaTypeMapping m = dba.getMapping(((SingleFieldIdentity)value).getTargetClass(), storeMgr, clr); ScalarExpression oidExpr = m.newLiteral(qs, ((SingleFieldIdentity)value).getKeyAsObject()); bExpr = expr.expressionList.getExpression(0).eq(oidExpr);
/** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readLong(); }
/** Write this object. Write the superclass first. * @param out the output */ @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeObject(keyAsObject); }
/** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { LongIdentity other = (LongIdentity) obj; return key == other.key; } }
/** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof IntIdentity) { IntIdentity other = (IntIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); }
/** Return the key as an Object. The method is synchronized to avoid * race conditions in multi-threaded environments. * @return the key as an Object. * @since 2.0 */ public synchronized Object getKeyAsObject() { if (keyAsObject == null) { keyAsObject = createKeyAsObject(); } return keyAsObject; }
/** Construct this instance with the key value. */ private void construct(byte key) { this.key = key; hashCode = super.hashClassName() ^ key; }
/** Set the given key as the key for this instance. * Compute the hash code for the instance. * @param key The key to use * @since 2.0 */ protected void setKeyAsObject(Object key) { assertKeyNotNull(key); keyAsObject = key; }
/** * Accessor for the target class name for the specified single field identity. * @param id The identity * @return The target class name */ public String getTargetClassNameForSingleFieldIdentity(Object id) { // TODO Use JPOX-internal SingleFieldIdentity if (id instanceof SingleFieldIdentity) { return ((SingleFieldIdentity)id).getTargetClassName(); } return null; }