Parses the field facet configurations.
@param fieldFacetObject The JSON sub-node with the field facet configurations.
@return The field facet configurations.
356348
protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject) {

        try {
            String field = fieldFacetObject.getString(JSON_KEY_FACET_FIELD);
            String name = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_NAME);
            String label = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_LABEL);
            Integer minCount = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_MINCOUNT);
            Integer limit = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_LIMIT);
            String prefix = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_PREFIX);
            String sorder = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_ORDER);
            I_CmsSearchConfigurationFacet.SortOrder order;
            try {
                order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);
            } catch (Exception e) {
                order = null;
            }
            String filterQueryModifier = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_FILTERQUERYMODIFIER);
            Boolean isAndFacet = parseOptionalBooleanValue(fieldFacetObject, JSON_KEY_FACET_ISANDFACET);
            List<String> preselection = parseOptionalStringValues(fieldFacetObject, JSON_KEY_FACET_PRESELECTION);
            Boolean ignoreFilterAllFacetFilters = parseOptionalBooleanValue(
                fieldFacetObject,
                JSON_KEY_FACET_IGNOREALLFACETFILTERS);
            return new CmsSearchConfigurationFacetField(
                field,
                name,
                minCount,
                limit,
                prefix,
                label,
                order,
                filterQueryModifier,
                isAndFacet,
                preselection,
                ignoreFilterAllFacetFilters);
        } catch (JSONException e) {
            LOG.error(
                Messages.get().getBundle().key(Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_FACET_FIELD),
                e);
            return null;
        }
    }
489856
private static JsonObject getFieldJsonObject(Field field) {
        JsonObject fieldObj = new JsonObject();
        fieldObj.add("type", field.getType());
        fieldObj.add("key", field.getKey());
        fieldObj.add("displayName", field.getDisplayName());

        String fieldDesc = field.getDescription();
        if (fieldDesc != null) {
            fieldObj.add("description", field.getDescription());
        }

        Boolean fieldIsHidden = field.getIsHidden();
        if (fieldIsHidden != null) {
            fieldObj.add("hidden", field.getIsHidden());
        }

        JsonArray array = new JsonArray();
        List<String> options = field.getOptions();
        if (options != null && !options.isEmpty()) {
            for (String option : options) {
                JsonObject optionObj = new JsonObject();
                optionObj.add("key", option);

                array.add(optionObj);
            }
            fieldObj.add("options", array);
        }

        return fieldObj;
    }
1229580
@Override
	public <T> T toObject(String json, Class<T> clazz, boolean ignoreUnknownField) {
		if (json == null || json.length() == 0) {
			return null;
		}

		try {
			if (ignoreUnknownField) {
				return mapperIgnoreUnknownField.readValue(json, clazz);
			}
			else {
				return mapper.readValue(json, clazz);
			}
		}
		catch (Exception e) {
			throw new JsonException(e.getMessage(), e);
		}
	}
1005123
public static Field[] getDeclaredFields(Field relationalField)
    {
        Field[] fields;
        if (isCollection(relationalField.getType()))
        {
            fields = PropertyAccessorHelper.getGenericClass(relationalField).getDeclaredFields();
        }
        else
        {
            fields = relationalField.getType().getDeclaredFields();
        }
        return fields;
    }
583897
public static Map<String, Object> configureObjectFieldsWithProperties(
            final Object object,
            final Map<String, Object> inputConfig
    )
    {
        return configureObjectFieldsWithProperties(object, buildFieldProperties(object), inputConfig);
    }
1059967
public static <T> List<Field> getAnnotatedFields(Object object, Class<? extends Annotation> annotationClass) {
		return getAnnotatedFields(object.getClass(), annotationClass);
	}
907101
@Nullable
  public static Long parseLongObj (@Nullable final Object aObject)
  {
    return parseLongObj (aObject, DEFAULT_RADIX, null);
  }
1038706
public JTSFeature parseFeature(JSONObject feature) throws JSONException {
		JTSFeature feat = new JTSFeature(null);

		JSONObject geometry = (JSONObject) feature.get("geometry");

		String geomType = geometry.get("type").toString();
		if (geomType.compareTo("Point") == 0) {
			JSONArray coords = geometry.getJSONArray("coordinates");
			double x = coords.getDouble(0);
			double y = coords.getDouble(1);

			GeometryFactory factory = new GeometryFactory();
			Coordinate c = new Coordinate();
			c.x = x;
			c.y = y;
			Point p = factory.createPoint(c);
			feat.setGeometry(new JTSGeometry(p));
		} // TODO process other geometry types

		JSONObject props = feature.getJSONObject("properties");
		Iterator it = props.keys();

		String key;		
		
		String val;
		feat.setText("");
		while (it.hasNext()) {
			key = it.next().toString();
			val = props.getString(key);
			feat.addField(key, val, 0);	
			if (val.indexOf("http") == -1) {
				feat.setText(feat.getText() + "  " + val);
			}
		}

		return feat;
	}
652563
private Field[] getAllInstanceFields(final Object obj) {
		Field[] fields = instanceFieldsByClass.get(obj.getClass());

		if (fields == null) {
			List<Field> fieldList = ReflectionUtil.
					getAllFields(obj, excludeStatic, excludeTransient);
			fields = fieldList.toArray(new Field[fieldList.size()]);

			instanceFieldsByClass.put(obj.getClass(), fields);
		}

		return fields;
	}
277485
private void parseField()
    throws IOException
  {
    int accessFlags = readShort();
    int nameIndex = readShort();
    int descriptorIndex = readShort();

    JavaField field = new JavaField();
    field.setJavaClass(_class);
    field.setName(_cp.getUtf8(nameIndex).getValue());
    field.setDescriptor(_cp.getUtf8(descriptorIndex).getValue());
    field.setAccessFlags(accessFlags);

    int attributesCount = readShort();

    for (int i = 0; i < attributesCount; i++) {
      Attribute attr = parseAttribute();

      field.addAttribute(attr);
    }

    _class.addField(field);
  }
537396
@Override
    public BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
    {
        BeanInfo beanInfo = null;

        checkNull(context, "context");

        try
        {
            Facelet compositeComponentFacelet;
            FaceletFactory.setInstance(_faceletFactory);
            try
            {
                compositeComponentFacelet
                        = _faceletFactory.getCompositeComponentMetadataFacelet(componentResource.getURL());
            }
            finally
            {
                FaceletFactory.setInstance(null);
            }
            //context.getAttributes().put(BUILDING_COMPOSITE_COMPONENT_METADATA, Boolean.TRUE);

            // Create a temporal tree where all components will be put, but we are only
            // interested in metadata.
            UINamingContainer compositeComponentBase
                    = (UINamingContainer) context.getApplication().createComponent(
                    context, UINamingContainer.COMPONENT_TYPE, null);

            // Fill the component resource key, because this information should be available
            // on metadata to recognize which is the component used as composite component base.
            // Since this method is called from Application.createComponent(FacesContext,Resource),
            // and in that specific method this key is updated, this is the best option we
            // have for recognize it (also this key is used by UIComponent.isCompositeComponent)
            compositeComponentBase.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);

            // According to UserTagHandler, in this point we need to wrap the facelet
            // VariableMapper, so local changes are applied on "page context", but
            // data is retrieved from full context
            FaceletContext faceletContext = (FaceletContext) context.
                    getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
            VariableMapper orig = faceletContext.getVariableMapper();
            try
            {
                faceletContext.setVariableMapper(new VariableMapperWrapper(orig));

                compositeComponentBase.pushComponentToEL(context, compositeComponentBase);

                compositeComponentFacelet.apply(context, compositeComponentBase);

                compositeComponentBase.popComponentFromEL(context);
            }
            finally
            {
                faceletContext.setVariableMapper(orig);
            }

            beanInfo = (BeanInfo) compositeComponentBase.getAttributes().get(UIComponent.BEANINFO_KEY);
        }
        catch (IOException e)
        {
            throw new FacesException(e);
        }
        //finally
        //{
        //context.getAttributes().remove(BUILDING_COMPOSITE_COMPONENT_METADATA);
        //}

        return beanInfo;
    }
981799
public Object getFieldValueByType(Object fieldValue) throws Exception {
        return ClassUtils.getValeByType(field.getType(), fieldValue);
    }
1034317
@SuppressWarnings("unchecked")
    private Object parseObject(
            Object input,
            Class<?> declaredType,
            MetaProperty<?> metaProp,
            Class<?> beanType,
            SerIterable parentIterable) throws Exception {

        // parse based on type
        if (Bean.class.isAssignableFrom(declaredType)) {
            if (input instanceof Map) {
                return parseBean((Map<String, Object>) input, declaredType);
            } else {
                return parseSimple(input, declaredType);
            }
        } else {
            if (input instanceof List || input instanceof Map) {
                SerIterable childIterable = null;
                if (metaProp != null) {
                    childIterable = settings.getIteratorFactory().createIterable(metaProp, beanType, true);
                } else if (parentIterable != null) {
                    childIterable = settings.getIteratorFactory().createIterable(parentIterable);
                }
                if (childIterable == null) {
                    if (input instanceof List) {
                        if (declaredType.isArray()) {
                            childIterable = SerIteratorFactory.array(declaredType.getComponentType());
                        } else {
                            childIterable = SerIteratorFactory.list(Object.class, Collections.<Class<?>>emptyList());
                        }
                    } else {
                        childIterable = SerIteratorFactory.map(
                                String.class, Object.class, Collections.<Class<?>>emptyList());
                    }
                }
                return parseIterable(input, childIterable);
            } else {
                return parseSimple(input, declaredType);
            }
        }
    }
79487
@SuppressWarnings({ "rawtypes", "unchecked" })
	public Object getObject(NodeConfig rootNode, Class rootClass, Object rootObject) 
			throws UnmarshalException, SecurityException{
		
		Field[] fields = getClassFields(rootClass);
		Map<String, Field> elementMap = new HashMap<String, Field>();
		Map<String, Field> attributeMap = new HashMap<String, Field>();
		Field elementValue = null;
		
		for(Field field : fields){
			if(field.isAnnotationPresent(Element.class)){
				Element element = (Element)field.getAnnotation(Element.class);
				elementMap.put(element.name(), field);
				continue;
			}
			if(field.isAnnotationPresent(Attribute.class)){
				Attribute attribute = (Attribute)field.getAnnotation(Attribute.class);
				attributeMap.put(attribute.name(), field);
				continue;
			}
			if(field.isAnnotationPresent(ElementValue.class)){
				elementValue = field;
				continue;
			}
		}
		
		Object targetObject = null;
		try {
			if(rootObject!=null){
				Constructor constructor = rootClass.getConstructor(new Class[]{rootObject.getClass()});
                targetObject = constructor.newInstance(rootObject);
			}else{
				targetObject = rootClass.newInstance();
			}
		} catch (Exception e) {
			throw new UnmarshalException(e);
		}
		
		boolean isNalaObject = targetObject instanceof XmlObject ? true : false;
		
		if(rootNode.hasChildren()){
			List childrenNode = rootNode.getChildrenNodes();
			for(Iterator iterNode = childrenNode.iterator(); iterNode.hasNext();){
				NodeConfig nodeConfig = (NodeConfig)iterNode.next();
				
				Field field = elementMap.get(nodeConfig.getName());
				if(field!=null){
					String fieldType = field.getType().getName();
					Object fieldValue = null;
					List<Object> listField = null;
					
					field.setAccessible(true);
					
					if(fieldType.equals(Constant.LIST_CLASS)){
						String listTypeName = field.getGenericType().toString();
						fieldType = listTypeName.substring(Constant.LIST_CLASS.length() + 1, listTypeName.length() -1 );
						try {
							listField = (List<Object>)field.get(targetObject);
						} catch (IllegalArgumentException e) {
							throw new UnmarshalException(e);
						} catch (IllegalAccessException e) {
							throw new UnmarshalException(e);
						}
					}
					
					ObjectValueCreator objectValueCreator = new ObjectValueCreator();
					
					fieldValue = objectValueCreator.getValue(fieldType, nodeConfig);
					
					if(fieldValue==null){
						//如果字段类别是带有$(表示内部类)则采用先构造外部类, 然后通过外部类生成内部类实例
						if(fieldType.indexOf('$')>0){
							try{
								fieldValue = getObject(nodeConfig, Class.forName(fieldType), targetObject);
							}catch (ClassNotFoundException e) {
								throw new UnmarshalException(e);
							}
						}else{
							try{
								fieldValue = getObject(nodeConfig, Class.forName(fieldType), null);
							}catch (ClassNotFoundException e) {
								throw new UnmarshalException(e);
							}
						}
					}
					
					if(listField!=null){
						listField.add(fieldValue);
						fieldValue = listField;
					}
					
					setField(field, targetObject, fieldValue);
				}

			}

		}
		
		if(rootNode.getValue()!=null && elementValue!=null){
			setField(elementValue, targetObject, rootNode.getValue());
		}
		
		if(rootNode.hasAttributes()){
			List attributes = rootNode.getAttribute();
			if(attributes!=null && attributes.size()>0){
				for(Iterator iterAttribute = attributes.iterator(); iterAttribute.hasNext();){
					AttributeConfig attributeConfig = (AttributeConfig)iterAttribute.next();

					Field field = attributeMap.get(attributeConfig.getName());
					if(field!=null){
						String fieldType = field.getType().getName();
						Object attributeValue = TypeConver.converValue(fieldType, attributeConfig.getValue());
						setField(field, targetObject, attributeValue);
					}
				}
			}
		}
		
		if(isNalaObject){
			setNameSpaces(rootNode, targetObject);
		}
		
		return targetObject;
	}
313722
public void parse(SourceMapObject sourceMapObject, SourceMapSupplier sectionSupplier)
      throws SourceMapParseException {
    if (sourceMapObject.getVersion() != 3) {
      throw new SourceMapParseException("Unknown version: " + sourceMapObject.getVersion());
    }

    String file = sourceMapObject.getFile();
    if (file != null && file.isEmpty()) {
      throw new SourceMapParseException("File entry is empty");
    }

    if (sourceMapObject.getSections() != null) {
      // Looks like a index map, try to parse it that way.
      parseMetaMap(sourceMapObject, sectionSupplier);
      return;
    }

    lineCount = sourceMapObject.getLineCount();
    sourceRoot = sourceMapObject.getSourceRoot();
    sources = sourceMapObject.getSources();
    sourcesContent = sourceMapObject.getSourcesContent();
    names = sourceMapObject.getNames();

    if (lineCount >= 0) {
      lines = new ArrayList<>(lineCount);
    } else {
      lines = new ArrayList<>();
    }

    // The value type of each extension is the native JSON type (e.g. JsonObject, or JSONObject
    // when compiled with GWT).
    extensions.putAll(sourceMapObject.getExtensions());
    new MappingBuilder(sourceMapObject.getMappings()).build();
  }
242030
private static List<BeanMappingObject> parseMappingObject(InputStream in) {
        Document doc = XmlHelper.createDocument(
                                                in,
                                                Thread.currentThread().getContextClassLoader().getResourceAsStream(
                                                                                                                   MAPPING_SCHEMA));
        Element root = doc.getDocumentElement();

        NodeList globalNodeList = root.getElementsByTagName("global-configurations");
        if (globalNodeList.getLength() > 1) {
            throw new BeanMappingException("global-configurations is exceed one node!");
        }

        BeanMappingBehavior globalBehavior = BeanMappingConfigHelper.getInstance().getGlobalBehavior();
        if (globalNodeList.getLength() == 1) {
            globalBehavior = BeanMappingBehaviorParse.parse(globalNodeList.item(0), globalBehavior);
            BeanMappingConfigHelper.getInstance().setGlobalBehavior(globalBehavior);
        }

        NodeList classAliasNodeList = root.getElementsByTagName("class-alias-configurations");
        for (int i = 0; i < classAliasNodeList.getLength(); i++) {
            ClassAliasParse.parseAndRegister(classAliasNodeList.item(i));
        }

        NodeList convertorNodeList = root.getElementsByTagName("convertors-configurations");
        for (int i = 0; i < convertorNodeList.getLength(); i++) {
            ConvertorParse.parseAndRegister(convertorNodeList.item(i));
        }

        NodeList functionClassNodeList = root.getElementsByTagName("function-class-configurations");
        for (int i = 0; i < functionClassNodeList.getLength(); i++) {
            FunctionClassParse.parseAndRegister(functionClassNodeList.item(i));
        }

        NodeList nodeList = root.getElementsByTagName("bean-mapping");
        List<BeanMappingObject> mappings = new ArrayList<BeanMappingObject>();
        // 解析BeanMappingObject属性
        for (int i = 0; i < nodeList.getLength(); i++) {
            BeanMappingObject config = BeanMappingParse.parse(nodeList.item(i), globalBehavior);
            // 添加到返回结果
            mappings.add(config);
        }

        return mappings;
    }
543533
private List<Facet> buildFacetsFromObject(@NotNull Object document) {
        List<Facet> facets = new ArrayList<>();

        for (Field field : document.getClass().getDeclaredFields()) {
            if (isFacetField(field)) {
                Object fieldValue = getFieldValue(document, field);

                if (fieldValue != null) {
                    List<Serializable> values = transformValue(fieldValue);

                    values.forEach(value -> {
                        Facet key = new Facet(new FacetType(field.getName(), value.getClass()), value);

                        facets.add(key);
                    });
                }
            }
        }

        return facets;
    }