<commit_before>/*
 * 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
 *
 *      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.apache.labs.amber.signature.beaninfo;

import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.beanutils.MethodUtils;

/**
 * Abstract BeanInfo implementation that exposes class properties with aliases.
 *
 * @version $Id$
 */
public abstract class AbstractAliasBeanInfo extends SimpleBeanInfo {

    /**
     * Maintains the original descriptors and the alias descriptor.
     */
    private final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();

    /**
     * Scans the class hierarchy and associates the property field to alias.
     *
     * @param klass the class is currently analyzed.
     * @param annotationType the annotation type that contains the alias name.
     * @param aliasPropertyName the annotation property name that contains the
     *        property alias.
     */
    public AbstractAliasBeanInfo(Class<?> klass,
            Class<? extends Annotation> annotationType,
            String aliasPropertyName) {
        this.visit(klass, annotationType, aliasPropertyName);
    }

    /**
     * Scans the class hierarchy and associates the property field to alias.
     *
     * @param klass the class is currently analyzed.
     * @param annotationType the annotation type that contains the alias name.
     * @param aliasPropertyName the annotation property name that contains the
     *        property alias.
     */
    private void visit(Class<?> klass,
            Class<? extends Annotation> annotationType,
            String aliasPropertyName) {<commit_msg>added support for default 'value' property<commit_after>/*
 * 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
 *
 *      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.apache.labs.amber.signature.beaninfo;

import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.beanutils.MethodUtils;

/**
 * Abstract BeanInfo implementation that exposes class properties with aliases.
 *
 * @version $Id$
 */
public abstract class AbstractAliasBeanInfo extends SimpleBeanInfo {

    /**
     * The default property name that contains the alias.
     */
    private static final String VALUE = "value";

    /**
     * Maintains the original descriptors and the alias descriptor.
     */
    private final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();

    /**
     * Scans the class hierarchy and associates the property field to alias.
     *
     * @param klass the class is currently analyzed.
     * @param annotationType the annotation type that contains the alias name.
     */
    public AbstractAliasBeanInfo(Class<?> klass,
            Class<? extends Annotation> annotationType) {
        this(klass, annotationType, VALUE);
    }

    /**
     * Scans the class hierarchy and associates the property field to alias.
     *
     * @param klass the class is currently analyzed.
     * @param annotationType the annotation type that contains the alias name.
     * @param aliasPropertyName the annotation property name that contains the
     *        property alias.
     */
    public AbstractAliasBeanInfo(Class<?> klass,
            Class<? extends Annotation> annotationType,
            String aliasPropertyName) {
        this.visit(klass, annotationType, aliasPropertyName);
    }

    /**
     * Scans the class hierarchy and associates the property field to alias.
     *
     * @param klass the class is currently analyzed.
     * @param annotationType the annotation type that contains the alias name.
     * @param aliasPropertyName the annotation property name that contains the
     *        property alias.
     */
    private void visit(Class<?> klass,
            Class<? extends Annotation> annotationType,
            String aliasPropertyName) {
{'fraction_non_alphanumeric': 0.06982588404236223, 'fraction_numerical': 0.0014360078980434393, 'mean_word_length': 3.2960678488820356, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2659009', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1309, 'n_words': 577}