blob: 4067b75166455f434096eaf8cfc747bbb2eea61e [file] [log] [blame]
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
package org.apache.myfaces.extensions.scripting.groovyloader.core
public class GroovyPropertyMapper
public GroovyPropertyMapper() {
* central algorithm which determines which property values are overwritten and which are not
public static void mapProperties(def target, def src) { {property ->
//ok here is the algorithm, basic datatypes usually are not copied but read in anew and then overwritten
//later on
//all others can be manually overwritten by adding an attribute <attributename>_changed
try {
if (
&& !property.key.equals("metaClass") //the class information and meta class information cannot be changed
&& !property.key.equals("class") //otherwise we will get following error
// java.lang.IllegalArgumentException: object is not an instance of declaring class
&& !( + "_changed") //||
//nothing further needed the phases take care of that
)) {
target.setProperty(property.key, property.value)
} catch (Exception e) {