Returns the string representation of the code that reads a primitive array property.
@param ref           The reference.
@param source        The type of the reference.
@param property      The property to read.
@return              The code.
11817
private static String readPrimitiveArrayProperty(String ref, TypeDef source, Property property)  {
        StringBuilder sb = new StringBuilder();
        Method getter = getterOf(source, property);
        sb.append("Arrays.asList(")
            .append(ref).append(".").append(getter.getName()).append("())")
            .append(".stream()").append(".collect(Collectors.toList())).toArray(new "+getter.getReturnType().toString()+"[])");
        return sb.toString();
    }
761723
public static String getter(ModelProperty property) {
		if (property.isPublicField())
			return property.getName();

		if (property.isFieldWithGetter()) {
			return "get" + converterField2Method.convert(property.getName()) + "()";
		} else if (property.isFieldWithIs()) {
			return "is" + converterField2Method.convert(property.getName()) + "()";
		} else {
			throw new PropertyVisibilityException(String.format("In class '%s' property '%s' can not be read",
					property.getParent().getElement().asType(), property.getName()));
		}
	}
529743
public ReferenceDescriptorDef getReference(String name)
    {
        ReferenceDescriptorDef refDef;

        for (Iterator it = _references.iterator(); it.hasNext(); )
        {
            refDef = (ReferenceDescriptorDef)it.next();
            if (refDef.getName().equals(name))
            {
                return refDef;
            }
        }
        return null;
    }
1368573
public Object read(Object object) {
        if(object == null) {
            String msg = "Can not evaluate the identifier \"" + _identifier + "\" on a null object.";
            LOGGER.error(msg);
            throw new RuntimeException(msg);
        }

        if(TRACE_ENABLED)
            LOGGER.trace("Read property " + _identifier + " on object of type " + object.getClass().getName());

        if(object instanceof Map)
            return mapLookup((Map)object, _identifier);
        else if(object instanceof List) {
            int i = parseIndex(_identifier);
            return listLookup((List)object, i);
        }
        else if(object.getClass().isArray()) {
            int i = parseIndex(_identifier);
            return arrayLookup(object, i);
        }
        else return beanLookup(object, _identifier);
    }
1058027
public Object toNeo4JProperty(Object source)
    {
        if (source instanceof BigDecimal || source instanceof BigInteger)
        {
            return source.toString();
        }
        else if ((source instanceof Calendar) || (source instanceof GregorianCalendar))
        {
            return PropertyAccessorHelper.fromSourceToTargetClass(String.class, Date.class,
                    ((Calendar) source).getTime());
        }
        if (source instanceof Date)
        {
            Class<?> sourceClass = source.getClass();
            return PropertyAccessorHelper.fromSourceToTargetClass(String.class, sourceClass, source);
        }
        return source;
    }
1343681
@SuppressWarnings("static-method")
	public String findStringValue(JvmAnnotationReference reference) {
		assert reference != null;
		for (final JvmAnnotationValue value : reference.getValues()) {
			if (value instanceof JvmStringAnnotationValue) {
				for (final String strValue : ((JvmStringAnnotationValue) value).getValues()) {
					if (strValue != null) {
						return strValue;
					}
				}
			}
		}
		return null;
	}
783713
public static Stream<String> propertiesReferenced( ICondition condition)
    {
    if( condition == null)
      {
      return Stream.empty();
      }
    
    PropertyVisitor propertyVisitor = new PropertyVisitor();
    condition.accept( propertyVisitor);
    return propertyVisitor.propertiesVisited();
    }
1235778
function getPropertyInfo(expression, source) {
      var originalExpression = expression;
      while (expression instanceof aureliaBinding.BindingBehavior || expression instanceof aureliaBinding.ValueConverter) {
          expression = expression.expression;
      }
      var object;
      var propertyName;
      if (expression instanceof aureliaBinding.AccessScope) {
          object = aureliaBinding.getContextFor(expression.name, source, expression.ancestor);
          propertyName = expression.name;
      }
      else if (expression instanceof aureliaBinding.AccessMember) {
          object = getObject(originalExpression, expression.object, source);
          propertyName = expression.name;
      }
      else if (expression instanceof aureliaBinding.AccessKeyed) {
          object = getObject(originalExpression, expression.object, source);
          propertyName = expression.key.evaluate(source);
      }
      else {
          throw new Error("Expression '" + originalExpression + "' is not compatible with the validate binding-behavior.");
      }
      if (object === null || object === undefined) {
          return null;
      }
      return { object: object, propertyName: propertyName };
  }
1019744
public static void copyProperties(final Object source, final Object target) {

        ExceptionUtils.iae.throwIfNull(source, SOURCE_IS_NULL_MESSAGE);
        ExceptionUtils.iae.throwIfNull(target, TARGETIS_NULL_MESSAGE);
        Class<Object> sourceClass = ClassUtils.getClass(source);
        Class<Object> targetClass = ClassUtils.getClass(target);
        Field[] sourceFields = sourceClass.getDeclaredFields();
        Field[] targetFields = targetClass.getDeclaredFields();
        try {
            for (Field sourceField : sourceFields) {
                Field targetField = getFieldByField(targetFields, sourceField);
                if (targetField != null) {
                    getAndSetValue(source, sourceField, target, targetField);
                }
            }
        } catch (Exception e) {
            throw new FatalBeanException(CAN_NOT_COPY_PROPERTIES, e);
        }
    }
845236
private Reference createDefinitionResourceBindingListenerReference(String refName,
                                                                       String bindingName,
                                                                       String type,
                                                                       @Sensitive Map<String, Object> properties) {
        Boolean transactional = (Boolean) properties.get("transactional");
        Map<String, Object> bindingProperties = Collections.<String, Object> singletonMap("transactional", transactional == null || transactional);

        ResourceBindingImpl binding = resourceBindingListenerManager.binding(refName, bindingName, type, bindingProperties);
        if (binding != null) {
            return new IndirectReference(refName, binding.getBindingName(), type, null, binding.getBindingListenerName(), false);
        }

        return null;
    }
215389
@Override
	public String getQualifiedName(char innerClassDelimiter) {
		if (references != null && !references.isEmpty()) {
			StringBuilder result = new StringBuilder();
			for(JvmTypeReference reference: references) {
				if (result.length() > 0) {
					result.append(getDelimiter());
				}
				result.append(reference.getQualifiedName(innerClassDelimiter));
			}
			return result.toString();
		}
		return super.getIdentifier();
	}
1224863
void toJSONString(final Map<ReferenceEqualityKey<JSONReference>, CharSequence> jsonReferenceToId,
            final boolean includeNullValuedFields, final int depth, final int indentWidth,
            final StringBuilder buf) {
        final boolean prettyPrint = indentWidth > 0;
        final int n = items.size();
        int numDisplayedFields;
        if (includeNullValuedFields) {
            numDisplayedFields = n;
        } else {
            numDisplayedFields = 0;
            for (final Entry<String, Object> item : items) {
                if (item.getValue() != null) {
                    numDisplayedFields++;
                }
            }
        }
        if (objectId == null && numDisplayedFields == 0) {
            buf.append("{}");
        } else {
            buf.append(prettyPrint ? "{\n" : "{");
            if (objectId != null) {
                // id will be non-null if this object does not have an @Id field, but was referenced by
                // another object (need to include ID_TAG)
                if (prettyPrint) {
                    JSONUtils.indent(depth + 1, indentWidth, buf);
                }
                buf.append('"');
                buf.append(JSONUtils.ID_KEY);
                buf.append(prettyPrint ? "\": " : "\":");
                JSONSerializer.jsonValToJSONString(objectId, jsonReferenceToId, includeNullValuedFields, depth + 1,
                        indentWidth, buf);
                if (numDisplayedFields > 0) {
                    buf.append(',');
                }
                if (prettyPrint) {
                    buf.append('\n');
                }
            }
            for (int i = 0, j = 0; i < n; i++) {
                final Entry<String, Object> item = items.get(i);
                final Object val = item.getValue();
                if (val != null || includeNullValuedFields) {
                    final String key = item.getKey();
                    if (key == null) {
                        // Keys must be quoted, so the unquoted null value cannot be a key
                        // (Should not happen -- JSONParser.parseJSONObject checks for null keys)
                        throw new IllegalArgumentException("Cannot serialize JSON object with null key");
                    }
                    if (prettyPrint) {
                        JSONUtils.indent(depth + 1, indentWidth, buf);
                    }
                    buf.append('"');
                    JSONUtils.escapeJSONString(key, buf);
                    buf.append(prettyPrint ? "\": " : "\":");
                    JSONSerializer.jsonValToJSONString(val, jsonReferenceToId, includeNullValuedFields, depth + 1,
                            indentWidth, buf);
                    if (++j < numDisplayedFields) {
                        buf.append(',');
                    }
                    if (prettyPrint) {
                        buf.append('\n');
                    }
                }
            }
            if (prettyPrint) {
                JSONUtils.indent(depth, indentWidth, buf);
            }
            buf.append('}');
        }
    }
1117106
@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public Object parse(String source) throws Exception {

		// Parse source
		Tree node = new Tree();
		LinkedProperties properties = new LinkedProperties();
		properties.load(new StringReader(source));
		LinkedHashMap<Object, Object> map = properties.map;

		final HashMap<String, Boolean> zeroIndexes = new HashMap<>();
		final HashMap<String, Boolean> arrays = new HashMap<>();

		// Convert Map to Node
		final StringBuilder path = new StringBuilder();
		for (Map.Entry<Object, Object> entry : map.entrySet()) {
			String key = (String) entry.getKey();
			String value = (String) entry.getValue();

			final StringTokenizer st = new StringTokenizer(key, ". ");
			path.setLength(0);
			while (st.hasMoreTokens()) {
				String token = st.nextToken();

				String prefix = path.toString();
				Boolean array = arrays.get(prefix);

				boolean number;
				if (array != null && !array) {
					number = false;
				} else {
					number = isNumeric(token);
				}

				if (number && array == null) {

					// Analyze array
					array = true;
					final ArrayList<Integer> indexes = new ArrayList<>();
					for (Object o : map.keySet()) {
						String t = (String) o;
						if (t.startsWith(prefix)) {
							int l = prefix.length() + 1;
							int i = t.indexOf('.', l);
							if (i > -1) {
								t = t.substring(l, i);
							} else {
								t = t.substring(l);
							}
							if (isNumeric(t)) {
								int idx = Integer.parseInt(t);
								if (indexes.contains(idx) && i == -1) {

									// Double index!
									array = false;
									break;
								}
								indexes.add(idx);
							} else {

								// Not numeric!
								array = false;
								break;
							}
						}
					}

					// Check index sequence (1,2,3,etc.)
					Collections.sort(indexes);
					int prev = Integer.MIN_VALUE;
					for (int idx : indexes) {
						if (prev == Integer.MIN_VALUE) {

							// First element is not "0" or "1"
							if (idx != 0 && idx != 1) {
								array = false;
								break;
							}

						} else if (prev - idx > 1) {

							// Not sequential!
							array = false;
							break;
						}
						prev = idx;
					}

					arrays.put(prefix, array);
					if (array) {
						String test = prefix + ".0";
						boolean zeroIndex = false;
						for (Object o : map.keySet()) {
							if (((String) o).startsWith(test)) {
								zeroIndex = true;
								break;
							}
						}
						zeroIndexes.put(prefix, zeroIndex);
					} else {
						number = false;
					}
				}

				if (number) {
					path.append('[');
					int idx = Integer.parseInt(token);
					if (!zeroIndexes.get(prefix)) {
						idx--;
					}
					path.append(idx);
					path.append(']');
				} else {
					if (path.length() > 0) {
						path.append('.');
					}
					path.append(token);
				}

			}
			node.put(path.toString(), (String) value);
		}

		// Store first indexes in metadata block
		Object result = node.asObject();
		if (!zeroIndexes.isEmpty()) {
			Tree meta = node.getMeta();
			Tree indexMap = meta.putMap(FIRST_INDEX);
			for (Map.Entry<String, Boolean> entry : zeroIndexes.entrySet()) {
				indexMap.put(entry.getKey(), entry.getValue() ? 0 : 1);
			}

			// Pushback metadata into the value map
			if (result instanceof Map) {
				((Map) result).put(Config.META, meta.asObject());
			}
		}
		return result;
	}
135023
public Object javaToSql(Object source) throws ConversionException
    {

        if (source == null)
        {
            return NULLVALUE;
        }

        try
        {
            List stringList = (List) source;
            if (stringList.isEmpty())
            {
                return NULLVALUE;
            }

            StringBuffer result = new StringBuffer();
            for (int i = 0; i < stringList.size(); i++)
            {
                String newSt = (String) stringList.get(i);
                // introduced in JDK 1.4, replace with commons-lang
                // newSt = newSt.replaceAll("#", "##");
                newSt = StringUtils.replace(newSt, "#", "##");
                if (i > 0)
                {
                    result.append("#");
                }
                result.append(newSt);
            }
            return result.toString();
        }
        catch (ClassCastException e)
        {
            throw new ConversionException("Object is not a List of String it is a"
                    + source.getClass().getName());
        }
    }
1015284
public static String print(RefType type) {
        return type.match(new RefType.MatchBlock<String>() {

            @Override
            public String _case(ClassType x) {
                final StringBuilder builder = new StringBuilder(x.baseName);
                if (!x.typeArguments.isEmpty()) {
                    builder.append("<");
                    boolean first = true;
                    for (RefType typeArgument : x.typeArguments) {
                        if (first) {
                            first = false;
                        } else {
                            builder.append(", ");
                        }
                        builder.append(print(typeArgument));
                    }
                    builder.append(">");
                }
                return builder.toString();
            }

            @Override
            public String _case(ArrayType x) {
                return print(x.heldType) + "[]";
            }});
    }
312676
@Override
	public Object parse(byte[] source) throws Exception {
		return parse(new String(source, StandardCharsets.UTF_8));
	}
993402
Reference getReference() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getReference");
        }

        // Create a reference object describing this class
        final Reference reference = new Reference(getConnectionType(),
                        getClass().getName(), null);

        // Make sure no-one can pull the rug from beneath us.
        synchronized (_properties) {

            // Convert the map of properties into an encoded form, where the
            // keys have the necessary prefix on the front, and the values are
            // all Strings.
            final Map encodedMap = JmsJcaReferenceUtils.getInstance()
                            .getStringEncodedMap(_properties, defaultJNDIProperties);

            // Now turn the encoded map into the reference items.
            for (final Iterator iterator = encodedMap.entrySet().iterator(); iterator
                            .hasNext();) {

                final Map.Entry entry = (Map.Entry) iterator.next();
                final String prefixedKey = (String) entry.getKey();
                final String stringForm = (String) entry.getValue();

                // Store the prefixed key and value in string form.
                reference.add(new StringRefAddr(prefixedKey, stringForm));

            }

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, "getReference", reference);
        }
        return reference;

    }