Enrich configuredField with get and set define in xml configuration.
@param configuredClass class of field
@param configuredField configured field
@return this
166806
public XML fillMappedField(Class<?> configuredClass, MappedField configuredField) {
		
		Attribute attribute = getGlobalAttribute(configuredField, configuredClass);
		
		if(isNull(attribute))
			attribute = getAttribute(configuredField, configuredClass);
		
		if(!isNull(attribute)){
			if(isEmpty(configuredField.getMethod()))
				configuredField.getMethod(attribute.getGet());
			if(isEmpty(configuredField.setMethod()))
				configuredField.setMethod(attribute.getSet());
		}
		return this;
	}
189747
public final Cache2kBuilder<K, V> name(Class<?> _class, String _fieldName) {
    if (_fieldName == null) {
      throw new NullPointerException();
    }
    config().setName(_class.getName() + "." + _fieldName);
    return this;
  }
175141
public Configuration<T> setConfiguration(Map<String, String> configuration) {
        Validate.notNull(configuration, "Properties for configuration of recorder extension can not be a null object!");
        this.configuration = configuration;
        return this;
    }
818330
@SuppressWarnings("unchecked")
	public <T> Class<T> getImplementingClass(Class<T> theClass) {
		if (!theClass.isAssignableFrom(getImplementingClass())) {
			throw new ConfigurationException("Unable to convert " + getImplementingClass() + " to " + theClass);
		}
		return (Class<T>) getImplementingClass();
	}
1066507
public static <T extends Annotation> Set<Field> getAnnotatedFields(Class<? extends Object> clazz,
			Class<T> annotation) {
		if (Object.class.equals(clazz)) {
			return Collections.emptySet();
		}
		Set<Field> annotatedFields = new HashSet<Field>();
		Field[] fields = clazz.getDeclaredFields();
		for (Field field : fields) {
			if (field.getAnnotation(annotation) != null) {
				annotatedFields.add(field);
			}
		}
		annotatedFields.addAll(getAnnotatedFields(clazz.getSuperclass(), annotation));
		return annotatedFields;
	}
1081664
private static CmsLuceneFieldConfiguration createStandardConfiguration() {

        CmsLuceneFieldConfiguration result = new CmsLuceneFieldConfiguration();
        result.setName(STR_STANDARD);
        result.setDescription(STR_STANDARD_DESCRIPTION);

        CmsLuceneField field;
        // content mapping, store as compressed value
        field = new CmsLuceneField(
            CmsSearchField.FIELD_CONTENT,
            "%(key.field.content)",
            true,
            true,
            true,
            true,
            true,
            null,
            null);
        field.addMapping(new CmsSearchFieldMapping(CmsSearchFieldMappingType.CONTENT, null, true));
        result.addField(field);

        // title mapping as a keyword
        field = new CmsLuceneField(
            CmsSearchField.FIELD_TITLE,
            CmsLuceneField.IGNORE_DISPLAY_NAME,
            true,
            true,
            false,
            false,
            null);
        field.addMapping(
            new CmsSearchFieldMapping(CmsSearchFieldMappingType.PROPERTY, CmsPropertyDefinition.PROPERTY_TITLE, true));
        result.addField(field);

        // title mapping as indexed field
        field = new CmsLuceneField(CmsSearchField.FIELD_TITLE_UNSTORED, "%(key.field.title)", false, true);
        field.addMapping(
            new CmsSearchFieldMapping(CmsSearchFieldMappingType.PROPERTY, CmsPropertyDefinition.PROPERTY_TITLE, true));
        result.addField(field);

        // mapping of "Keywords" property to search field with the same name
        field = new CmsLuceneField(CmsSearchField.FIELD_KEYWORDS, "%(key.field.keywords)", true, true);
        field.addMapping(
            new CmsSearchFieldMapping(
                CmsSearchFieldMappingType.PROPERTY,
                CmsPropertyDefinition.PROPERTY_KEYWORDS,
                true));
        result.addField(field);

        // mapping of "Description" property to search field with the same name
        field = new CmsLuceneField(CmsSearchField.FIELD_DESCRIPTION, "%(key.field.description)", true, true);
        field.addMapping(
            new CmsSearchFieldMapping(
                CmsSearchFieldMappingType.PROPERTY,
                CmsPropertyDefinition.PROPERTY_DESCRIPTION,
                true));
        result.addField(field);

        // "meta" field is a combination of "Title", "Keywords" and "Description" properties
        field = new CmsLuceneField(CmsSearchField.FIELD_META, "%(key.field.meta)", false, true);
        field.addMapping(
            new CmsSearchFieldMapping(CmsSearchFieldMappingType.PROPERTY, CmsPropertyDefinition.PROPERTY_TITLE, true));
        field.addMapping(
            new CmsSearchFieldMapping(
                CmsSearchFieldMappingType.PROPERTY,
                CmsPropertyDefinition.PROPERTY_KEYWORDS,
                true));
        field.addMapping(
            new CmsSearchFieldMapping(
                CmsSearchFieldMappingType.PROPERTY,
                CmsPropertyDefinition.PROPERTY_DESCRIPTION,
                true));
        result.addField(field);

        return result;
    }
1311189
public static void generate(ConfigurationImpl configuration,
                                ClassTree classtree) {
        TreeWriter treegen;
        DocPath filename = DocPaths.OVERVIEW_TREE;
        try {
            treegen = new TreeWriter(configuration, filename, classtree);
            treegen.generateTreeFile();
            treegen.close();
        } catch (IOException exc) {
            configuration.standardmessage.error(
                        "doclet.exception_encountered",
                        exc.toString(), filename);
            throw new DocletAbortException(exc);
        }
    }
737805
public I_CmsXmlConfiguration getConfiguration(Class<?> clazz) {

        for (int i = 0; i < m_configurations.size(); i++) {
            I_CmsXmlConfiguration configuration = m_configurations.get(i);
            if (clazz.equals(configuration.getClass())) {
                return configuration;
            }
        }
        return null;
    }
743243
private void addClasses(Class<?>[] classes, HashSet<Class<?>> result, String fieldName){
		
		if(classes == null || classes.length==0)	
			Error.classesAbsent(fieldName, configuredClass);
		
		for (Class<?> classe : classes)	result.add(classe);
	}
997030
public static <F extends Field<F>, P extends Property> Setting of(
      String description, F field, P property) {
    return new Setting<>(
        description,
        field.label(description),
        property);
  }
350244
@Nonnull
    public BugInstance addOptionalField(@CheckForNull XField xfield) {
        if (xfield == null) {
            return this;
        }
        return addField(xfield.getClassName(), xfield.getName(), xfield.getSignature(), xfield.isStatic());
    }
130846
@Override
    public Configuration<?> configure() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "configure");
        }

        Configuration<?> configuration = null;
        Class<? extends ValidationProvider<?>> clazz = this.getDefaultProviderClass();
        if (clazz == null) {
            // get configuration object from default provider.
            configuration = Validation.byDefaultProvider().configure();

        } else {
            @SuppressWarnings("unchecked")
            ProviderSpecificBootstrap<?> providerBootstrap = Validation.byProvider((Class) clazz);
            configuration = providerBootstrap.configure();
        }

        setMessageInterpolator(configuration);
        setTraversableResolver(configuration);
        setConstraintValidatorFactory(configuration);
        setConstraintMappings(configuration);
        setProperties(configuration);

        // Indicate to the provider configuration that xml should be ignored. We do this
        // because we need to find the correct xml's for each module, as the provider doesn't
        // guarantee this in an EE environment.
        configuration.ignoreXmlConfiguration();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "configure", configuration);
        }

        return configuration;
    }
216894
private Optional<ArrayPositionSetter> createField(final Class<?> beanClass, final String fieldName) {
        
        final String positionFieldName = fieldName + "Position";
        
        final Field positionField;
        try {
            positionField = beanClass.getDeclaredField(positionFieldName);
            positionField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            return Optional.empty();
        }
        
        if(!List.class.isAssignableFrom(positionField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) positionField.getGenericType();
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0];
        
        if(valueType.equals(CellPosition.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                   try {
                       List<CellPosition> positionListObj = (List<CellPosition>) positionField.get(beanObj);
                       if(positionListObj == null) {
                           positionListObj = new ArrayList<>();
                           positionField.set(beanObj, positionListObj);
                       }
                       
                       Utils.addListWithIndex(positionListObj, position, index);
                       
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(valueType.equals(Point.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        List<Point> positionListObj = (List<Point>) positionField.get(beanObj);
                        if(positionListObj == null) {
                            positionListObj = new ArrayList<>();
                            positionField.set(beanObj, positionListObj);
                        }
                        
                        
                        Utils.addListWithIndex(positionListObj, position.toPoint(), index);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(valueType.equals(CellAddress.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        List<CellAddress> positionListObj = (List<CellAddress>) positionField.get(beanObj);
                        if(positionListObj == null) {
                            positionListObj = new ArrayList<>();
                            positionField.set(beanObj, positionListObj);
                        }
                        
                        Utils.addListWithIndex(positionListObj, position.toCellAddress(), index);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
        
        }
        
        return Optional.empty();
    }
623398
private void doConfigure(XmlParser.Node rootNode, Object obj, HashMap<String,String> properties, boolean checkForDuplicates, CollectionHelper ch) throws XmlBeanException {
        // loop thru all child nodes
        if (rootNode.hasChildren()) {

            for (XmlParser.Node node : rootNode.getChildren()) {
                
                // tag name represents a property we're going to set
                String propertyName = node.getTag();

                // find the property if it exists
                BeanProperty property = null;
                
                if (ch != null) {
                    // make sure node tag name matches propertyName
                    if (!propertyName.equals(ch.getValueProperty().getName())) {
                        throw new PropertyNotFoundException(propertyName, node.getPath(), obj.getClass(), "Collection can only be configured with a property name of [" + ch.getValueProperty().getName() + "] but [" + propertyName + "] was used instead");
                    }
                    property = ch.getValueProperty();
                } else {
                    try {
                        property = BeanUtil.findBeanProperty(obj.getClass(), propertyName, true);
                    } catch (IllegalAccessException e) {
                        throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Illegal access while attempting to reflect property from class", e);
                    }
                }

                // if property is null, then this isn't a valid property on this object
                if (property == null) {
                    throw new PropertyNotFoundException(propertyName, node.getPath(), obj.getClass(), "Property [" + propertyName + "] not found");
                }

                // only some attributes are permitted if we're dealing with a
                // collection or map at this point
                boolean isCollection = (Collection.class.isAssignableFrom(property.getType()));
                boolean isMap = (Map.class.isAssignableFrom(property.getType()));
                
                // were any attributes included?
                String typeAttrString = null;
                String valueAttrString = null;
                String keyAttrString = null;
                
                // check if an annotation is present for the field
                if (property.getField() != null) {
                    XmlBeanProperty annotation = property.getField().getAnnotation(XmlBeanProperty.class);
                    if (annotation != null) {
                        if (!StringUtil.isEmpty(annotation.value())) {
                            valueAttrString = annotation.value();
                        }
                        if (!StringUtil.isEmpty(annotation.key())) {
                            keyAttrString = annotation.key();
                        }
                    }
                }
                
                // process attributes within the xml itself
                if (node.hasAttributes()) {
                    for (Attribute attr : node.getAttributes()) {
                        if (attr.getName().equals("type")) {
                            typeAttrString = attr.getValue();
                        } else if (attr.getName().equals("value") && (isCollection || isMap)) {
                            // only permitted on collections or map
                            valueAttrString = attr.getValue();
                        } else if (attr.getName().equals("key") && (isMap || (ch != null && ch.isMapType()))) {
                            // only permitted on map type OR on a map value
                            keyAttrString = attr.getValue();
                        } else {
                            throw new PropertyNoAttributesExpectedException(propertyName, node.getPath(), obj.getClass(), "One or more attributes not allowed for property [" + propertyName + "]");
                        }
                    }
                }
                
                //
                // otherwise, the property exists, attempt to set it
                //

                // is there actually a "setter" method -- we shouldn't let
                // user's be able to configure fields in this case
                // unless accessing private properties is allowed
                // unless a collection helper is also null
                if (ch == null && !this.accessPrivateProperties && property.getAddMethod() == null && property.getSetMethod() == null) {
                    throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Not permitted to add or set property [" + propertyName + "]");
                }

                // if we can "add" this property, then turn off checkForDuplicates
                // we also don't check for duplicates in the case of a collection
                if (ch != null || property.canAdd()) {
                    checkForDuplicates = false;
                }
                
                // was this property already previously set?
                // only use this check if an "add" method doesn't exist for the bean
                if (checkForDuplicates && properties.containsKey(node.getPath())) {
                    throw new PropertyAlreadySetException(propertyName, node.getPath(), obj.getClass(), "Property [" + propertyName + "] was already previously set in the xml");
                }
                // add this property to our hashmap
                properties.put(node.getPath(), null);

                
                // if a "type" attribute was included - check that it both exists
                // and is compatible with the type of the property it is being added/set to
                Class typeAttrClass = null;
                if (typeAttrString != null) {
                    try {
                        typeAttrClass = Class.forName(typeAttrString);
                    } catch (ClassNotFoundException e) {
                        throw new PropertyInvalidTypeException(propertyName, node.getPath(), obj.getClass(), "Unable to find class [" + typeAttrString + "] specified in type attribute of property '" + propertyName + "'");
                    }
                    
                    if (!property.getType().isAssignableFrom(typeAttrClass)) {
                        throw new PropertyInvalidTypeException(propertyName, node.getPath(), obj.getClass(), "Unable to assign a value of specified type [" + typeAttrString + "] to property [" + propertyName + "] which is a type [" + property.getType().getName() + "]");
                    }
                }
                
                // the object we'll eventually add or set
                Object value = null;
                // get the node's text value
                String nodeText = node.getText();
                
                // is this a simple conversion?
                if (TypeConverterUtil.isSupported(property.getType())) {
                    // was any text set?  if not, throw an exception
                    if (nodeText == null) {
                        throw new PropertyIsEmptyException(propertyName, node.getPath(), obj.getClass(), "Value for property [" + propertyName + "] was empty in xml");
                    }

                    // try to convert this to a Java object value
                    try {
                        value = TypeConverterUtil.convert(nodeText, property.getType());
                    } catch (ConversionException e) {
                        throw new PropertyConversionException(propertyName, node.getPath(), obj.getClass(), "The value [" + nodeText + "] for property [" + propertyName + "] could not be converted to a(n) " + property.getType().getSimpleName() + ". " + e.getMessage());
                    }

                // otherwise, this is a "complicated" type
                } else {

                    // only "get" the property if its possible -- e.g. if there
                    // is only an addXXXX method available, then this would throw
                    // an exception, so we'll check to see if getting the property
                    // is possible first
                    if (property.canGet()) {
                        try {
                            value = property.get(obj);
                        } catch (IllegalAccessException e) {
                            throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Illegal access while attempting to get property value from object", e);
                        } catch (InvocationTargetException e) {
                            Throwable t = e;
                            // this generally means the setXXXX method on the object
                            // threw an exception -- we want to unwrap that and just
                            // return that exception instead
                            if (e.getCause() != null) {
                                t = e.getCause();
                            }
                            throw new PropertyInvocationException(propertyName, node.getPath(), obj.getClass(), "The existing value for property [" + propertyName + "] caused an exception during get", t.getMessage(), t);
                        }
                    }
                    
                    // if null, then we need to create a new instance of it
                    if (value == null) {
                        Class newType = property.getType();
                        // create a new instance of either the actual type OR the
                        // type specified in the "type" attribute
                        if (typeAttrClass != null) {
                            newType = typeAttrClass;
                        }
                        
                        try {
                            value = newType.newInstance();
                        } catch (InstantiationException e) {
                            throw new XmlBeanClassException("Failed while attempting to create object of type " + newType.getName(), e);
                        } catch (IllegalAccessException e) {
                            throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Illegal access while attempting to create new instance of " + newType.getName(), e);
                        }
                    }
                    
                    // special handling for "collections" -- required for handling
                    // the values in configuring of child objects
                    CollectionHelper newch = null;
                    if (value instanceof Collection || value instanceof Map) {
                        newch = createCollectionHelper(node, obj, value, propertyName, property, valueAttrString, keyAttrString);
                    }

                    // recursively configure the next object
                    doConfigure(node, value, properties, checkForDuplicates, newch);
                }
                
                // save this reference object back (since it was successfully configured)
                if (ch != null) {
                    if (ch.isCollectionType()) {
                        ch.getCollectionObject().add(value);
                    } else if (ch.isMapType()) {
                        // need to figure out the key value -- it may either be a value from the value OR a simple type
                        Object keyValue = null;
                        if (ch.getKeyProperty() == null) {
                            // a KEY must have been set!
                            if (StringUtil.isEmpty(keyAttrString)) {
                                throw new PropertyIsEmptyException(propertyName, node.getPath(), obj.getClass(), "The XML attribute [key] was null or empty and is required");
                            } else {
                                try {
                                    keyValue = TypeConverterUtil.convert(keyAttrString, ch.getKeyClass());
                                } catch (ConversionException e) {
                                    throw new PropertyConversionException(propertyName, node.getPath(), obj.getClass(), "Unable to cleanly convert key value [" + keyAttrString + "] into type [" + ch.getKeyClass().getName() + ": " + e.getMessage(), e);
                                }
                            }
                        } else {
                            try {
                                // extract the key value from the object
                                keyValue = ch.getKeyProperty().get(value);
                            } catch (Exception e) {
                                throw new PropertyPermissionException(propertyName, node.getPath(), value.getClass(), "Unable to access property to get the value of the key: " + e.getMessage(), e);
                            }
                            
                            if (keyValue == null) {
                                throw new PropertyIsEmptyException(propertyName, node.getPath(), obj.getClass(), "The value of the key [" + ch.getKeyProperty().getName() + "] was null; unable to put value onto the map");
                            }
                        }

                        ch.getMapObject().put(keyValue, value);
                    } else {
                        throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Unsupported collection/map type used");
                    }
                } else {
                    try {
                        property.addOrSet(obj, value);
                    } catch (InvocationTargetException e) {
                        Throwable t = e;
                        // this generally means the setXXXX method on the object
                        // threw an exception -- we want to unwrap that and just
                        // return that exception instead
                        if (e.getCause() != null) {
                            t = e.getCause();
                        }
                        throw new PropertyInvocationException(propertyName, node.getPath(), obj.getClass(), "The value '" + nodeText + "' for property '" + propertyName + "' caused an exception", t.getMessage(), t);
                    } catch (IllegalAccessException e) {
                        throw new PropertyPermissionException(propertyName, node.getPath(), obj.getClass(), "Illegal access while setting property", e);
                    }
                }
            }
        }
    }
473999
public static Field getField(Class clazz, String fieldName) {
        if (Map.class.isAssignableFrom(clazz)) {
            return new Field(new MapField(fieldName));
        }
        java.lang.reflect.Field field = null;
        while (field == null && clazz != null) {
            try {
                field = clazz.getDeclaredField(fieldName);
                field.setAccessible(true);
            } catch (Exception e) {
                clazz = clazz.getSuperclass();
            }
        }
        return new Field(field);
    }
974482
public static FeaturableConfig imports(Xml root)
    {
        Check.notNull(root);

        final String clazz;
        if (root.hasChild(ATT_CLASS))
        {
            clazz = root.getChild(ATT_CLASS).getText();
        }
        else
        {
            clazz = DEFAULT_CLASS_NAME;
        }

        final String setup;
        if (root.hasChild(ATT_SETUP))
        {
            setup = root.getChild(ATT_SETUP).getText();
        }
        else
        {
            setup = Constant.EMPTY_STRING;
        }

        return new FeaturableConfig(clazz, setup);
    }
1014532
public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) {
        return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services);
    }