/** * Assigns a {@link ConcurrentMap} instance to the given field. * Used on deserialization only. */ static <T extends MetadataStandard> void setMapForField(final Class<T> classe, final T instance, final String name) throws InvalidClassException { try { AccessController.doPrivileged(new FinalFieldSetter<>(classe, name)).set(instance, new ConcurrentHashMap<>()); } catch (ReflectiveOperationException e) { throw FinalFieldSetter.readFailure(e); } }
/** * Invoked on deserialization for restoring the {@link #parameters} array. * * @param in the input stream from which to deserialize a group of tensor parameters. * @throws IOException if an I/O error occurred while reading or if the stream contains invalid data. * @throws ClassNotFoundException if the class serialized on the stream is not on the classpath. */ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); try { AccessController.doPrivileged(new FinalFieldSetter<>(TensorParameters.class, "parameters")).set(this, createCache()); } catch (ReflectiveOperationException e) { throw FinalFieldSetter.readFailure(e); } } }