Returns the string representation of the code that reads an object array property.
@param ref           The reference.
@param source        The type of the reference.
@param property      The property to read.
@return              The code.
495268
private static String readObjectArrayValue(String ref, TypeDef source, Property property)  {
        StringBuilder sb = new StringBuilder();
        Method getter = getterOf(source, property);
        TypeRef getterTypeRef = getter.getReturnType();
        TypeRef propertyTypeRef = property.getTypeRef();
        if (propertyTypeRef instanceof ClassRef && getterTypeRef instanceof ClassRef) {
            String nextRef = variables.pop();
            try {
                TypeDef propertyType = ((ClassRef) propertyTypeRef).getDefinition();
                TypeDef getterType = ((ClassRef) getterTypeRef).getDefinition();
                sb.append(indent(ref))
                        .append("Arrays.stream(")
                        .append("(Map[])(" + ref + " instanceof Map ? ((Map)" + ref + ").getOrDefault(\"" + getterOf(source, property).getName() + "\" , new Map[0]) : new Map[0]))")
                        //.append("("+getterType.getFullyQualifiedName()+"[])(" + ref + " instanceof Map ? ((Map)" + ref + ").getOrDefault(\"" + getterOf(source, property).getName() + "\" , new " +getterType.getFullyQualifiedName()+"[0]) : new "+ getterType.getFullyQualifiedName()+"[0]))")
                        .append(".map(").append(nextRef).append(" ->").append(convertMap(nextRef, getterType, propertyType)).append(")")
                        .append(".toArray(size-> new "+propertyType.getFullyQualifiedName()+"[size])");
            } finally {
                variables.push(nextRef);
            }
            return sb.toString();
        }
        throw new IllegalArgumentException("Expected an object property and a matching object getter!!");
    }
375192
public static Object convertToArray(Object source, Class<?> target) throws ConversionException {
        try {
            Class<?> targetType = target.getComponentType();
            if (source.getClass().isArray()) {
                Object targetInstance = Array.newInstance(targetType, Array.getLength(source));
                for (int i = 0; i < Array.getLength(source); i++) {
                    Array.set(targetInstance, i, convert(Array.get(source, i), targetType));
                }
                return targetInstance;
            }
            if (source instanceof Collection<?>) {
                Collection<?> sourceCollection = (Collection<?>) source;
                Object targetInstance = Array.newInstance(target.getComponentType(), sourceCollection.size());
                Iterator<?> it = sourceCollection.iterator();
                int i = 0;
                while (it.hasNext()) {
                    Array.set(targetInstance, i++, convert(it.next(), targetType));
                }
                return targetInstance;
            }
            throw new ConversionException("Unable to convert to array");
        } catch (Exception ex) {
            throw new ConversionException("Error converting to array", ex);
        }
    }
311718
int readReferenceOrNull (Input input, Class type, boolean mayBeNull) {
		if (type.isPrimitive()) type = getWrapperClass(type);
		boolean referencesSupported = referenceResolver.useReferences(type);
		int id;
		if (mayBeNull) {
			id = input.readVarInt(true);
			if (id == NULL) {
				if (TRACE || (DEBUG && depth == 1)) log("Read", null, input.position());
				readObject = null;
				return REF;
			}
			if (!referencesSupported) {
				readReferenceIds.add(NO_REF);
				return readReferenceIds.size;
			}
		} else {
			if (!referencesSupported) {
				readReferenceIds.add(NO_REF);
				return readReferenceIds.size;
			}
			id = input.readVarInt(true);
		}
		if (id == NOT_NULL) {
			if (TRACE) trace("kryo", "Read: <not null>" + pos(input.position()));
			// First time object has been encountered.
			id = referenceResolver.nextReadId(type);
			if (TRACE) trace("kryo", "Read initial reference " + id + ": " + className(type) + pos(input.position()));
			readReferenceIds.add(id);
			return readReferenceIds.size;
		}
		// The id is an object reference.
		id -= 2; // - 2 because 0 and 1 are used for NULL and NOT_NULL.
		readObject = referenceResolver.getReadObject(type, id);
		if (DEBUG) debug("kryo", "Read reference " + id + ": " + string(readObject) + pos(input.position()));
		return REF;
	}
981710
def get_object_references(tb, source, max_string_length=1000):
    
    global obj_ref_regex
    referenced_attr = set()
    for line in source.split('\n'):
        referenced_attr.update(set(re.findall(obj_ref_regex, line)))
    referenced_attr = sorted(referenced_attr)
    info = []
    for attr in referenced_attr:
        v = string_variable_lookup(tb, attr)
        if v is not ValueError:
            ref_string = format_reference(v, max_string_length=max_string_length)
            info.append((attr, ref_string))
    return info
508647
private static String readAnnotationProperty(String ref, TypeDef source, Property property) {
        return convertReference(ref, source, ((ClassRef)property.getTypeRef()).getDefinition());
    }
1313349
public static <T> T convert(Object source, TypeReference<T> destType) {
        return JSON.convertValue(source, destType);
    }
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();
	}
1047330
public static String getReferencePropertyOriginalName(final String refPropertyName) {
        final int i = refPropertyName.lastIndexOf(REFERENCE_PROPERTY_SUFFIX);
        return i < 0 ? refPropertyName : refPropertyName.substring(0, i);
    }
294723
public com.google.protobuf.ByteString
      getRefererBytes() {
    java.lang.Object ref = referer_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      referer_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
1001776
function getReferenceExpression ( expression ) {
  	var members = [], refinement;

  	while ( expression.t === MEMBER && expression.r.t === REFINEMENT ) {
  		refinement = expression.r;

  		if ( refinement.x ) {
  			if ( refinement.x.t === REFERENCE ) {
  				members.unshift( refinement.x );
  			} else {
  				members.unshift( flattenExpression( refinement.x ) );
  			}
  		} else {
  			members.unshift( refinement.n );
  		}

  		expression = expression.x;
  	}

  	if ( expression.t !== REFERENCE ) {
  		return null;
  	}

  	return {
  		r: expression.n,
  		m: members
  	};
  }
1284137
@Override
	public Object parse(String source) throws Exception {
		Source s = sources.poll();
		final char[] chars = source.toCharArray();
		if (s == null) {
			s = new Source(chars);
		} else {
			s.set(chars);
		}
		final Object result = parseNext(s);
		if (sources.size() > Config.POOL_SIZE) {
			return result;
		}
		sources.add(s);
		return result;
	}
1237615
function propertyType(property) {
  var type;
  if (property === null || property.type === null) {
    return 'null';
  } else if (property.$ref != null) {
    // Type is a reference
    return simpleRef(property.$ref);
  } else if (property['x-type']) {
    // Type is read from the x-type vendor extension
    type = (property['x-type'] || '').toString().replace('List<', 'Array<');
    return type.length == 0 ? 'null' : type;
  } else if (property['x-nullable']) {
    return 'null | ' + propertyType(
      Object.assign(property, {'x-nullable': undefined}));
  } else if (!property.type && (property.anyOf || property.oneOf)) {
    let variants = (property.anyOf || property.oneOf).map(propertyType);
    return {
      allTypes: mergeTypes(...variants),
      toString: () => variants.join(' | ')
    };
  } else if (Array.isArray(property.type)) {
    let variants = property.type.map(type => propertyType(Object.assign({}, property, {type})));
    return {
      allTypes: mergeTypes(...variants),
      toString: () => variants.join(' | ')
    };
  }
  switch (property.type) {
    case 'null':
      return 'null';
    case 'string':
      if (property.enum && property.enum.length > 0) {
        return '\'' + property.enum.join('\' | \'') + '\'';
      }
      else if (property.const) {
        return '\'' + property.const + '\'';
      }
      return 'string';
    case 'array':
      if (Array.isArray(property.items)) { // support for tuples
        if (!property.maxItems) return 'Array<any>'; // there is unable to define unlimited tuple in TypeScript
        let minItems = property.minItems || 0,
            maxItems = property.maxItems,
            types = property.items.map(propertyType);
        types.push(property.additionalItems ? propertyType(property.additionalItems) : 'any');
        let variants = [];
        for (let i = minItems; i <= maxItems; i++) variants.push(types.slice(0, i));
        return {
          allTypes: mergeTypes(...types.slice(0, maxItems)),
          toString: () => variants.map(types => `[${types.join(', ')}]`).join(' | ')
        };
      }
      else {
        let itemType = propertyType(property.items);
        return {
          allTypes: mergeTypes(itemType),
          toString: () => 'Array<' + itemType + '>'
        };
      }
    case 'integer':
    case 'number':
      if (property.enum && property.enum.length > 0) return property.enum.join(' | ');
      if (property.const) return property.const;
      return 'number';
    case 'boolean':
      return 'boolean';
    case 'file':
      return 'Blob';
    case 'object':
      var def = '{';
      let memberCount = 0;
      var allTypes = [];
      if (property.properties) {
        for (var name in property.properties) {
          var prop = property.properties[name];
          if (memberCount++) def += ', ';
          type = propertyType(prop);
          allTypes.push(type);
	        let required = property.required && property.required.indexOf(name) >= 0;
	        def += name + (required ? ': ' : '?: ') + type;
        }
      }
      if (property.additionalProperties) {
        if (memberCount++) def += ', ';
        type = typeof property.additionalProperties === 'object' ?
            propertyType(property.additionalProperties) : 'any';
	      allTypes.push(type);
        def += '[key: string]: ' + type;
      }
      def += '}';

      return {
        allTypes: mergeTypes(...allTypes),
        toString: () => def,
      };
    default:
      return 'any';
  }
}
1304612
protected void getPropertySource(final SourceFile src) {

		final String sourceUuid = source.getUuid();

		final SourceLine line = src.line(source, "public static final");

		line.append(" Property<");
		line.append(getValueType());
		line.append("> ");
		line.append(SchemaHelper.cleanPropertyName(source.getPropertyName()));
		line.append("Property");
		line.append(" = new ");
		line.append(getPropertyType());
		line.append("(");
		line.quoted(source.getPropertyName());

		if (StringUtils.isNotBlank(source.getDbName())) {
			line.append(", ");
			line.quoted(source.getDbName());
		}

		if (getPropertyParameters() != null) {
			line.append(getPropertyParameters());
		}

		line.append(")");

		if (StringUtils.isNotBlank(source.getContentType())) {
			line.append(".contentType(").quoted(source.getContentType()).append(")");
		}

		if (StringUtils.isNotBlank(source.getDefaultValue())) {
			line.append(".defaultValue(").append(getDefaultValue()).append(")");
		}

		if (StringUtils.isNotBlank(source.getFormat())) {
			line.append(".format(").quoted(StringEscapeUtils.escapeJava(source.getFormat())).append(")");
		}

		if (StringUtils.isNotBlank(sourceUuid)) {

			line.append(".setSourceUuid(").quoted(sourceUuid).append(")");

		} else {

			if (StringUtils.isNotBlank(source.getReadFunction())) {
				line.append(".readFunction(").quoted(StringEscapeUtils.escapeJava(source.getReadFunction())).append(")");
			}

			if (StringUtils.isNotBlank(source.getWriteFunction())) {
				line.append(".writeFunction(").quoted(StringEscapeUtils.escapeJava(source.getWriteFunction())).append(")");
			}
		}

		if (StringUtils.isNotBlank(source.getTypeHint())) {
			line.append(".typeHint(").quoted(StringEscapeUtils.escapeJava(source.getTypeHint())).append(")");
		}

		if (source.isUnique()) {
			line.append(".unique()");
		}

		if (source.isCompound()) {
			line.append(".compound()");
		}

		if (source.isNotNull()) {
			line.append(".notNull()");
		}

		if (source.isCachingEnabled()) {
			line.append(".cachingEnabled(true)");
		}

		if (source.isIndexed()) {

			if (StringUtils.isNotBlank(source.getDefaultValue())) {

				line.append(".indexedWhenEmpty()");

			} else {

				line.append(".indexed()");
			}
		}

		if (source.isReadOnly()) {

			line.append(".readOnly()");
		}

		final String[] transformators = source.getTransformators();
		if (transformators != null && transformators.length > 0) {

			line.append(".transformators(");
			line.quoted(StringUtils.join(transformators, "\", \""));
			line.append(")");
		}

		if (source.isPartOfBuiltInSchema()) {
			line.append(".partOfBuiltInSchema()");
		}

		line.append(".dynamic()");

		if (StringUtils.isNotBlank(source.getHint())) {
			line.append(".hint(").quoted(StringEscapeUtils.escapeJava(source.getHint())).append(")");
		}

		if (StringUtils.isNotBlank(source.getCategory())) {
			line.append(".category(").quoted(StringEscapeUtils.escapeJava(source.getCategory())).append(")");
		}

		line.append(";");
	}
1113932
private static String convertMap(String ref, TypeDef source, TypeDef target) {
        Method ctor = BuilderUtils.findBuildableConstructor(target);
        String arguments = ctor.getArguments().stream()
                .map(p -> readMapValue(ref, source, p))
                .collect(joining(",\n","\n", ""));

        StringBuilder sb = new StringBuilder();
        sb.append("new ").append(target.getFullyQualifiedName()).append("(").append(arguments).append(")");
        return sb.toString();
    }
727399
@Programmatic
    public DocumentType findByReference(
            final String reference) {
        return queryResultsCache.execute(
                () -> repositoryService.firstMatch(
                    new QueryDefault<>(DocumentType.class,
                            "findByReference",
                            "reference", reference)),
                DocumentTypeRepository.class,
                "findByReference", reference);

    }
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;
    }
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());
        }
    }