All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.leeonky.jfactory.SingleValueExpression Maven / Gradle / Ivy

The newest version!
package com.github.leeonky.jfactory;

import com.github.leeonky.util.CollectionHelper;
import com.github.leeonky.util.Property;

import java.util.Objects;

class SingleValueExpression

extends Expression

{ private final Object value; private final TraitsSpec traitsSpec; public SingleValueExpression(Object value, TraitsSpec traitsSpec, Property

property) { super(property); this.value = value; this.traitsSpec = traitsSpec; } @Override protected boolean isPropertyMatch(Object propertyValue) { return property.getReaderType().isCollection() ? CollectionHelper.equals(propertyValue, value) : Objects.equals(propertyValue, property.getReader().tryConvert(value)); } @Override public Producer buildProducer(JFactory jFactory, Producer

parent) { if (intently) return traitsSpec.toBuilder(jFactory, property.getWriterType()).createProducer(); return new FixedValueProducer<>(property.getWriterType(), value); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy