org.glassfish.pfl.dynamic.copyobject.impl.CodegenCopierBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pfl-dynamic Show documentation
Show all versions of pfl-dynamic Show documentation
Functionality that may include class generation
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.glassfish.pfl.dynamic.copyobject.impl;
import org.glassfish.pfl.basic.reflection.Bridge;
import org.glassfish.pfl.basic.reflection.BridgePermission;
import org.glassfish.pfl.dynamic.copyobject.spi.ReflectiveCopyException;
import java.security.Permission;
import java.util.Map;
/**
* Base class for generated class copiers. Note that this class
* makes use of the unsafe copier through the Bridge class.
* Because of this, CodegenCopierBase could potentially be used
* to bypass security restrictions. Consequently, this class must be
* referenced inside a doPrivileged block, and a derived class
* must have the permissions needed for the
* Bridge class.
*/
public abstract class CodegenCopierBase implements ClassCopierOrdinaryImpl.ClassFieldCopier {
private static final Bridge bridge = Bridge.get();
private static final Permission getBridgePermission = new BridgePermission("getBridge");
private PipelineClassCopierFactory factory;
public CodegenCopierBase(PipelineClassCopierFactory factory) {
SecurityManager sman = System.getSecurityManager();
if (sman != null) {
sman.checkPermission(getBridgePermission);
}
this.factory = factory;
}
final protected void copyObject(Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy