private JField getJField(final JObject jobj) { return JObjectContainer.this.jdb.getJClass(jobj.getObjId()).getJField(this.storageId, JField.class); }
/** * Quick lookup for the {@link JField} corresponding to the given object and field storage ID. * * @param id object ID * @param storageId field storage ID * @param <T> expected field type * @return list of {@link JClass}es whose type is {@code type} or a sub-type, ordered by storage ID * @throws TypeNotInSchemaVersionException if {@code id} has a type that does not exist in this instance's schema version * @throws UnknownFieldException if {@code storageId} does not correspond to any field in the object's type */ @SuppressWarnings("unchecked") <T extends JField> T getJField(ObjId id, int storageId, Class<T> type) { final JField jfield = this.typeFieldMap.get(this.getTypeFieldKey(id.getStorageId(), storageId)); if (jfield == null) { this.getJClass(id.getStorageId()).getJField(storageId, type); // should always throw the appropriate exception assert false; } try { return type.cast(jfield); } catch (ClassCastException e) { throw new UnknownFieldException(storageId, jfield + "' is not a " + type.getSimpleName().replaceAll("^J(.*)Field$", "").toLowerCase() + " field"); } }