3d,0x93,0x6a,0xe7,0x6c,0x8a,0x71,
  0xc0,0x3c,0x50,0x15,0x13,0x24,0x34,0x9b,0x8f,0xb7,0x5f,0xfe,0xb5,0x3a,0x40,0xd2,
  0xc8,0x44,0x4c,0xcb,0x81,0xc2,0x9e,0x70,0x7d,0xe9,0xa2,0x26,0x12,0x92,0xc4,0x6e,
  0xe8,0x8,0x35,0xbc,0xa2,0x94,0x79,0x6e,0x2a,0x5c,0x89,0xd9,0x6e,0x48,0x5a,0x44,
  0x42,0xa8,0xea,0x9c,0x70,0x71,0x93,0x51,0xc2,0x19,0x11,0xcc,0xbd,0x7d,0x71,0x52,
  0xa8,0x9,0xc3,0x3,0x92,0x7a,0xe3,0x8a,0x3c,0xd8,0x9a,0x52,0x23,0x7f,0x34,0x2f,
  0x12,0x6e,0xfe,0x13,0xed,0x59,0xf3,0xda,0x3a,0x6c,0x74,0x4a,0x5e,0xd1,0x5a,0xc3,
  0xb,0x7,0x46,0xc,0x18,0x85,0x1f,0x28,0xed,0x51,0x2f,0x99,0xd5,0x14,0xbf,0xb5,
  0x4d,0xbc,0xb0,0x60,0x8,0x54,0x3d,0xa9,0x91,0x33,0xa0,0xda,0xa,0xa9,0xcf,0xca,
  0xf,0x19,0x15,0x11,0x9a,0x6b,0xbb,0x32,0x85,0x36,0xda,0x49,0xd,0x68,0xc2,0xce,
  0x1f,0x24,0x12,0xb8,0xda,0x69,0x42,0x3c,0x92,0xe5,0xc8,0x56,0x1d,0x0,0xe6,0xa7,
  0x31,0x96,0xda,0xce,0x47,0xd0,0x9c,0xd0,0x42,0xa7,0xc8,0x1,0xc9,0x1c,0x9a,0x71,
  0x72,0x51,0x68,0x71,0x9b,0x8f,0xba,0xd6,0x83,0x25,0x3e,0x5c,0x2a,0x3,0x1c,0xf7,
  0x1e,0x95,0x1a,0xca,0x40,0x4,0x29,0x27,0x15,0x2f,0x96,0x36,0xe6,0x40,0x0,0xfe,
  0x42,0x9e,0x23,0x89,0x63,0x12,0x41,0x21,0x7d,0xc3,0x24,0x30,0xc6,0x2b,0x38,0x7b,
  0x3b,0xf7,0x67,0x44,0x79,0x6f,0xca,0x95,0x91,0x1b,0xdc,0x13,0x11,0x1,0x5f,0x77,
  0x56,0xc7,0x4a,0xb0,0x64,0xd,0x6e,0x36,0xa8,0xc7,0xd2,0x84,0x42,0x13,0x7a,0x7f,
  0x17,0x5f,0x4a,0xe,0x16,0x2,0xae,0xdc,0xf6,0x35,0x4e,0x9,0xbd,0x76,0x32,0x8a,
  0x93,0x96,0xa8,0x19,0x55,0xa3,0x4e,0xf,0x7,0xa6,0x38,0x34,0x86,0xe0,0x13,0xb1,
  0x77,0x29,0xf5,0x2,0x85,0x9c,0x2c,0x60,0x93,0xf2,0x9e,0x3e,0xb4,0xc0,0xc0,0xce,
  0x4b,0x92,0xa0,0xf5,0x18,0xe0,0x7e,0x34,0xb9,0x1c,0xdd,0x9a,0xd0,0xed,0x84,0x1c,
  0x64,0xa4,0xcb,0x8a,0xce,0xca,0xaa,0x70,0x14,0x74,0x51,0x42,0xed,0x75,0x75,0xcb,
  0x87,0x1e,0xdc,0x7e,0x74,0xe1,0x2c,0x62,0x34,0xda,0x73,0x8e,0xac,0x6a,0x3f,0x34,
  0x3c,0xc7,0x6b,0x83,0x8e,0x98,0x15,0x70,0x56,0x91,0x75,0x53,0x76,0xa9,0x70,0xc,
  0xc0,0x7e,0xed,0xb8,0xef,0x93,0x52,0x46,0x58,0xc7,0x96,0xfb,0xac,0x7a,0x1,0x4c,
  0x45,0xfd,0xc6,0x51,/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed 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
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.api.internal.plugins;

import groovy.lang.MissingPropertyException;
import org.gradle.api.internal.BeanDynamicObject;
import org.gradle.api.plugins.ExtraPropertiesExtension;

import java.util.Map;

public class ExtraPropertiesDynamicObjectAdapter extends BeanDynamicObject {
    private final ExtraPropertiesExtension extension;
    private final Class<?> delegateType;

    public ExtraPropertiesDynamicObjectAdapter(Class<?> delegateType, ExtraPropertiesExtension extension) {
        super(extension);
        this.delegateType = delegateType;
        this.extension = extension;
    }

    public boolean hasProperty(String name) {
        return super.hasProperty(name) || extension.has(name);
    }

    public Map<String, ?> getProperties() {
        return extension.getProperties();
    }

    @Override
    public void setProperty(String name, Object value) throws MissingPropertyException {
        if (!hasProperty(name)) {
            throw new MissingPropertyException(name, delegateType);
        }

        super.setProperty(name, value);
    }

    @Override
    public boolean isMayImplementMissingMethods() {
        return false;
    }

    @Override
    public boolean isMayImplementMissingProperties() {
        return false;
    }
}
