Defines the required transformations to serialize a property to a CoAP object
@param kernel The transformation to apply during serialization
@param options Some options regarding the behavior of the property transform
481255
function serializeWith(kernel, options) {
    const transform = buildPropertyTransform(kernel, options);
    return (target, property) => {
        // get the class constructor
        const constr = target.constructor;
        // retrieve the current metadata
        const metadata = Reflect.getMetadata(METADATA_serializeWith, constr) || {};
        metadata[property] = transform;
        // store back to the object
        Reflect.defineMetadata(METADATA_serializeWith, metadata, constr);
    };
}
565988
public static void print( IntegralKernel kernel )
	{
		int x0 = 0,x1=0,y0=0,y1=0;
		for( ImageRectangle k : kernel.blocks) {
			if( k.x0 < x0 )
				x0 = k.x0;
			if( k.y0 < y0 )
				y0 = k.y0;
			if( k.x1 > x1 )
				x1 = k.x1;
			if( k.y1 > y1 )
				y1 = k.y1;
		}

		int w = x1-x0;
		int h = y1-y0;

		int sum[] = new int[ w*h ];

		for( int i = 0; i < kernel.blocks.length; i++ ) {
			ImageRectangle r = kernel.blocks[i];
			int value = kernel.scales[i];

			for( int y = r.y0; y < r.y1; y++ ) {
				int yy = y-y0;
				for( int x = r.x0; x < r.x1; x++ ) {
					int xx = x - x0;
					sum[ yy*w + xx ] += value;
				}
			}
		}

		System.out.println("IntegralKernel: TL = ("+(x0+1)+","+(y0+1)+") BR=("+x1+","+y1+")");
		for( int y = 0; y < h; y++ ) {
			for( int x = 0; x < w; x++ ) {
				System.out.printf("%4d ",sum[y*w+x]);
			}
			System.out.println();
		}
	}
524150
function normalizeOptions(options, Ctor) {
  if (!options) {
    return null;
  }

  if (options instanceof Ctor) {
    return options;
  }

  var instance = new Ctor();

  Object.keys(options).forEach(function(key) {
    if (typeof options[key] !== "undefined") {
      instance[key] = options[key];
    }
  });

  return instance;
}
93980
@Override
	protected void transform(final XtendConstructor source, final JvmGenericType container) {
		final String constructorName = container.getSimpleName();

		// Special case: static constructor
		if (source.isStatic()) {
			final JvmOperation staticConstructor = this.typesFactory.createJvmOperation();
			container.getMembers().add(staticConstructor);
			this.associator.associatePrimary(source, staticConstructor);
			staticConstructor.setSimpleName(Utils.STATIC_CONSTRUCTOR_NAME);
			staticConstructor.setVisibility(JvmVisibility.PRIVATE);
			staticConstructor.setStatic(true);
			staticConstructor.setReturnType(this._typeReferenceBuilder.typeRef(Void.TYPE));
			setBody(staticConstructor, source.getExpression());
			copyAndCleanDocumentationTo(source, staticConstructor);
			return;
		}

		final GenerationContext context = getContext(container);

		final boolean isVarArgs = Utils.isVarArg(source.getParameters());

		// Generate the unique identifier of the constructor.
		final QualifiedActionName actionKey = this.sarlSignatureProvider.createConstructorQualifiedName(container);

		// Generate all the constructor signatures related to the constructor to create.
		final InferredPrototype constructorSignatures = this.sarlSignatureProvider.createPrototypeFromSarlModel(
				actionKey,
				Utils.isVarArg(source.getParameters()), source.getParameters());

		// Generate the main Java constructor.
		final JvmConstructor constructor = this.typesFactory.createJvmConstructor();
		container.getMembers().add(constructor);
		this.associator.associatePrimary(source, constructor);
		constructor.setSimpleName(constructorName);
		setVisibility(constructor, source);
		constructor.setVarArgs(isVarArgs);

		// Generate the parameters
		final List<InferredStandardParameter> paramList = constructorSignatures.getOriginalParameterTypes();
		translateSarlFormalParameters(
				context,
				constructor, container, isVarArgs,
				source.getParameters(), false, paramList);

		// Generate additional information (type parameters, exceptions...)
		copyAndFixTypeParameters(source.getTypeParameters(), constructor);
		for (final JvmTypeReference exception : source.getExceptions()) {
			constructor.getExceptions().add(this.typeBuilder.cloneWithProxies(exception));
		}
		translateAnnotationsTo(source.getAnnotations(), constructor);

		// Set the body.
		setBody(constructor, source.getExpression());

		// The signature definition of the constructor.
		final ActionParameterTypes sigKey = this.sarlSignatureProvider.createParameterTypesFromJvmModel(
				isVarArgs, constructor.getParameters());

		// Update the list of generated constructors
		if (context != null) {
			context.getGeneratedConstructors().put(sigKey, constructor);
		}

		copyAndCleanDocumentationTo(source, constructor);

		final Runnable differedGeneration  = () -> {
			// Generate the Java functions that correspond to the action with the parameter default values applied.
			for (final Entry<ActionParameterTypes, List<InferredStandardParameter>> entry
					: constructorSignatures.getInferredParameterTypes().entrySet()) {

				if (context == null || !context.getGeneratedConstructors().containsKey(entry.getKey())) {
					final List<InferredStandardParameter> otherSignature = entry.getValue();
					// Generate the additional constructor that is invoke the main constructor previously generated.
					final JvmConstructor constructor2 = SARLJvmModelInferrer.this.typesFactory.createJvmConstructor();
					container.getMembers().add(constructor2);
					copyAndCleanDocumentationTo(source, constructor2);
					constructor2.setSimpleName(container.getSimpleName());
					constructor2.setVisibility(constructor.getVisibility());
					constructor2.setVarArgs(isVarArgs);

					final List<String> args = translateSarlFormalParametersForSyntheticOperation(
							constructor2, container, isVarArgs, otherSignature);

					addAnnotationSafe(
							constructor2, DefaultValueUse.class,
							constructorSignatures.getFormalParameterTypes().toString());
					appendGeneratedAnnotation(constructor2, context);

					setBody(constructor2, toStringConcatenation(
							"this(" //$NON-NLS-1$
							+ IterableExtensions.join(args, ", ") //$NON-NLS-1$
							+ ");")); //$NON-NLS-1$

					// Update the list of the generated constructors.
					if (context != null) {
						context.getGeneratedConstructors().put(entry.getKey(), constructor2);
					}
				}
			}
		};

		if (context != null) {
			context.getPreFinalizationElements().add(differedGeneration);
			context.setActionIndex(context.getActionIndex() + 1);
			context.incrementSerial(sigKey.hashCode());
		} else {
			differedGeneration.run();
		}
	}
476973
public static void setProperties(Object bean, Map<String,?> props, Class<? extends Annotation> tagCls) throws IntrospectionException, IllegalAccessException, InvocationTargetException, InstantiationException
	{
		Class<?> beanCls;
		PropertyDescriptor[] descriptors;
		Map<String,PropertyDescriptor> descriptorMap = new HashMap<String,PropertyDescriptor>();
		Method meth;
		String name;
		Object value;
		Class<?> propCls;
		Class<?> valCls;

		beanCls = bean.getClass();
		if((descriptors = Introspector.getBeanInfo(beanCls).getPropertyDescriptors())==null)
			throw new IllegalArgumentException("Unable to get PropertyDescriptors for class " + beanCls.getName() + '.');
		for(PropertyDescriptor pd : descriptors)
			descriptorMap.put(pd.getName(), pd);
		for(Map.Entry<String,?> prop : props.entrySet())
		{
			name = prop.getKey();
			value = prop.getValue();
			PropertyDescriptor pd;

			if((pd=descriptorMap.get(name))==null)
				throw new IllegalArgumentException("Bean class " + beanCls.getName() + " does not have property " + name + '.');
			if((meth=pd.getWriteMethod())==null)
				throw new IllegalArgumentException("Bean class " + beanCls.getName() + " does not have a setter for property " + name + '.');
			if((propCls = pd.getPropertyType())==null)
				throw new IllegalArgumentException("Bean class " + beanCls.getName() + " does not have a type for property " + name + '.');
			propCls = Reflections.wrapperIfPrimitive(propCls);
			if(value==null)
				valCls = propCls;
			else
				valCls = value.getClass();
			if(!propCls.isAssignableFrom(valCls))
			{
				if(String.class.equals(valCls))
				{
					setPropertyAsText(bean, name, (String)value, pd, propCls, tagCls);
					continue;
				}
				throw new IllegalArgumentException("Property " + name + " of class " + beanCls.getName() + " is of type " + propCls.getName() + " which is not assignable from " + valCls.getName() + '.');
			}
			if(tagCls!=null&&!meth.isAnnotationPresent(tagCls))
				throw new IllegalArgumentException("Write method " + meth + " for property " + name + " of class " + bean.getClass() + " does not have annotation " + tagCls + '.');
			meth.invoke(bean, prop.getValue());
		}
	}
539438
public static void convolve(Kernel2D_S32 kernel, InterleavedS32 src, InterleavedS32 dst ) {
		InputSanityCheck.checkSameShapeB(src, dst);

		boolean processed = BOverrideConvolveImageNormalized.invokeNativeConvolve(kernel,src,dst);
		
		if( !processed ) {
			if( kernel.width >= src.width || kernel.width >= src.height ) {
				ConvolveNormalizedNaive_IL.convolve(kernel, src, dst);
			} else {
				ConvolveImageNoBorder.convolve(kernel, src, dst, kernel.computeSum());
				ConvolveNormalized_JustBorder_IL.convolve(kernel, src, dst);
			}
		}
	}
685278
public void setProperty(int objIndex, int pid, int start, int elements, byte[] data)
		throws KNXTimeoutException, KNXRemoteException, KNXConnectionClosedException
	{
		if (closed)
			throw new KNXIllegalStateException("adapter closed");
		conn.send(new CEMIDevMgmt(CEMIDevMgmt.MC_PROPWRITE_REQ, getObjectType(objIndex),
			1, pid, start, elements, data), KNXnetIPConnection.WAIT_FOR_CON);
		findFrame(CEMIDevMgmt.MC_PROPWRITE_CON);
	}
320588
protected void renderOptions(FacesContext context, ResponseWriter rw, SelectOneMenu menu) throws IOException {
		Converter converter = menu.getConverter();
		List<SelectItemAndComponent> items = SelectItemUtils.collectOptions(context, menu, converter);
		
		SelectItemAndComponent selection = determineSelectedItem(context, menu, items, converter);

		for (int index = 0; index < items.size(); index++) {
			SelectItemAndComponent option = items.get(index);

			if (option.getSelectItem().isNoSelectionOption() && 
					menu.isHideNoSelectionOption() && selection != null)
				continue;
			
			renderOption(context, menu, rw, (option.getSelectItem()), index, option.getComponent(), 
					option == selection || (selection == null && option.getSelectItem().isNoSelectionOption()));
		}
	}
571484
function(options) {
      inputEx.SerializeField.superclass.setOptions.call(this, options);
   	this.options.className = options.className || 'inputEx-SerializedField';

		this.options.subfield = options.subfield || {type: 'string'};
		this.options.serializer = options.serializer || "json";
	}
1242052
protected void serialize(BinderContext context, E object, SerializerWrapper serializerWrapper, boolean writeStartAndEnd) throws Exception {

		switch (context.getSupportedFormat()) {
		case XML:
			try {
				XmlWrapperSerializer wrapper = ((XmlWrapperSerializer) serializerWrapper);
				XMLSerializer xmlSerializer=wrapper.xmlSerializer;

				if (writeStartAndEnd) {
					xmlSerializer.writeStartDocument();
				}
				serializeOnXml(object, xmlSerializer, 0);

				if (writeStartAndEnd) {
					xmlSerializer.writeEndDocument();
				}
			} catch (Exception e) {
				e.printStackTrace();
				throw (new KriptonRuntimeException(e));
			}
			break;
		default:
			if (context.getSupportedFormat().onlyText)
				serializeOnJacksonAsString(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
			else
				serializeOnJackson(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
			break;
		}
	}
1351637
public static ImmutableSet<CopyOption> getCopyOptions(CopyOption... options) {
    ImmutableSet<CopyOption> result = ImmutableSet.copyOf(options);
    if (result.contains(ATOMIC_MOVE)) {
      throw new UnsupportedOperationException("'ATOMIC_MOVE' not allowed");
    }
    return result;
  }
148824
public void setProcessorOptions(String processorOptions)
	{
		StringTokenizer tok = new StringTokenizer(processorOptions, ",");
		while (tok.hasMoreTokens())
			_processorOptions.add(tok.nextToken());
	}
758773
protected Map<String, OperationTransformer> buildOperationTransformers(AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry) {
        final Map<String, OperationTransformer> operations = new HashMap<String, OperationTransformer>();
        for(final Map.Entry<String, OperationTransformationEntry> entry: operationTransformers.entrySet()) {
            final OperationTransformer transformer = entry.getValue().getOperationTransformer(registry);
            operations.put(entry.getKey(), transformer);
        }
        return operations;
    }
147294
public void setConfigurationProperties(java.util.Collection<SdkConfigurationProperty> configurationProperties) {
        if (configurationProperties == null) {
            this.configurationProperties = null;
            return;
        }

        this.configurationProperties = new java.util.ArrayList<SdkConfigurationProperty>(configurationProperties);
    }
27727
protected void transform(SarlCapacityUses source, JvmGenericType container) {
		final GenerationContext context = getContext(container);
		if (context == null) {
			return;
		}
		for (final JvmTypeReference capacityType : source.getCapacities()) {
			final JvmType type = capacityType.getType();
			if (type instanceof JvmGenericType
					/*&& this.inheritanceHelper.isSubTypeOf(capacityType, Capacity.class, SarlCapacity.class)*/
					&& !context.getGeneratedCapacityUseFields().contains(capacityType.getIdentifier())) {
				// Generate the buffer field
				final String fieldName = Utils.createNameForHiddenCapacityImplementationAttribute(capacityType.getIdentifier());
				final JvmField field = this.typesFactory.createJvmField();
				container.getMembers().add(field);
				field.setVisibility(JvmVisibility.PRIVATE);
				field.setSimpleName(fieldName);
				field.setTransient(true);
				final JvmType clearableReferenceType = this.typeReferences.findDeclaredType(ClearableReference.class, container);
				final JvmTypeReference skillClearableReference = this.typeReferences.createTypeRef(
						clearableReferenceType,
						this.typeReferences.createTypeRef(this.typeReferences.findDeclaredType(Skill.class, container)));
				field.setType(skillClearableReference);

				this.associator.associatePrimary(source, field);

				addAnnotationSafe(field, Extension.class);
				field.getAnnotations().add(annotationClassRef(ImportedCapacityFeature.class,
						Collections.singletonList(capacityType)));
				appendGeneratedAnnotation(field, getContext(container));

				// Generate the calling function
				final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(
						fieldName);
				final JvmOperation operation = this.typesFactory.createJvmOperation();
				container.getMembers().add(operation);
				operation.setVisibility(JvmVisibility.PRIVATE);
				operation.setReturnType(cloneWithTypeParametersAndProxies(capacityType, operation));
				operation.setSimpleName(methodName);

				this.associator.associatePrimary(source, operation);

				setBody(operation, it -> {
					it.append("if (this.").append(fieldName).append(" == null || this."); //$NON-NLS-1$ //$NON-NLS-2$
					it.append(fieldName).append(".get() == null) {"); //$NON-NLS-1$
					it.increaseIndentation();
					it.newLine();
					it.append("this.").append(fieldName).append(" = ") //$NON-NLS-1$ //$NON-NLS-2$
							.append(Utils.HIDDEN_MEMBER_CHARACTER).append("getSkill("); //$NON-NLS-1$
					it.append(capacityType.getType()).append(".class);"); //$NON-NLS-1$
					it.decreaseIndentation();
					it.newLine();
					it.append("}"); //$NON-NLS-1$
					it.newLine();
					it.append("return ").append(Utils.HIDDEN_MEMBER_CHARACTER) //$NON-NLS-1$
							.append("castSkill(").append(capacityType.getType()).append(".class, this.") //$NON-NLS-1$ //$NON-NLS-2$
							.append(fieldName).append(");"); //$NON-NLS-1$
				});

				// Add the annotation dedicated to this particular method
				if (context.isAtLeastJava8()) {
					context.getPostFinalizationElements().add(() -> {
						final String inlineExpression = Utils.HIDDEN_MEMBER_CHARACTER
								+ "castSkill(" + capacityType.getSimpleName() //$NON-NLS-1$
								+ ".class, ($0" + fieldName //$NON-NLS-1$
								+ " == null || $0" + fieldName //$NON-NLS-1$
								+ ".get() == null) ? ($0" + fieldName //$NON-NLS-1$
								+ " = $0" + Utils.HIDDEN_MEMBER_CHARACTER + "getSkill(" //$NON-NLS-1$ //$NON-NLS-2$
								+ capacityType.getSimpleName()
								+ ".class)) : $0" + fieldName + ")"; //$NON-NLS-1$ //$NON-NLS-2$;
						this.inlineExpressionCompiler.appendInlineAnnotation(
								operation, source.eResource().getResourceSet(), inlineExpression, capacityType);
					});
				}
				appendGeneratedAnnotation(operation, context);
				if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
					addAnnotationSafe(operation, Pure.class);
				}

				context.addGeneratedCapacityUseField(capacityType.getIdentifier());
				context.incrementSerial(capacityType.getIdentifier().hashCode());
			}
		}
	}
1043283
public void eInit(XtendTypeDeclaration container, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlConstructor == null) {
			this.container = container;
			this.sarlConstructor = SarlFactory.eINSTANCE.createSarlConstructor();
			this.sarlConstructor.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
			container.getMembers().add(this.sarlConstructor);
		}
	}
803960
public static void configureMapper(ObjectMapper mapper, Application.Mode mode) {
        mapper.registerModule(new GuavaModule());
        mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
                .enable(SerializationFeature.WRITE_ENUMS_USING_INDEX)
                .enable(MapperFeature.PROPAGATE_TRANSIENT_MARKER)
                .disable(
                        SerializationFeature.WRITE_NULL_MAP_VALUES,
                        SerializationFeature.FAIL_ON_EMPTY_BEANS
                );
        if (!mode.isDev()) {
            mapper.disable(
                    DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
            );
        }
    }