当前位置: 首页>>代码示例>>Java>>正文


Java Setter类代码示例

本文整理汇总了Java中com.vaadin.server.Setter的典型用法代码示例。如果您正苦于以下问题:Java Setter类的具体用法?Java Setter怎么用?Java Setter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Setter类属于com.vaadin.server包,在下文中一共展示了Setter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readBean

import com.vaadin.server.Setter; //导入依赖的package包/类
@Override
public void readBean(BEAN bean) {
	if (binder.getBean() == null) {
		try {
			Constructor<BEAN> ctor = clz.getConstructor();
			binder.setBean(ctor.newInstance());
		} catch (InvocationTargetException | IllegalArgumentException | IllegalAccessException
				| InstantiationException | NoSuchMethodException | SecurityException e) {
			throw new UnsupportedOperationException("Not supported");
		}
	}
	BEAN targetBean = binder.getBean();
	binder.removeBean();
	binder.getBindings().stream().forEach(e -> {
		@SuppressWarnings("unchecked")
		Setter<BEAN, Object> setter = (Setter<BEAN, Object>) e.setter;
		if (setter != null) {
			setter.accept(targetBean, e.getter.apply(bean));
		}
	});
	binder.setBean(targetBean);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:23,代码来源:BinderAdapter.java

示例2: writeBean

import com.vaadin.server.Setter; //导入依赖的package包/类
@Override
public void writeBean(BEAN bean) throws ValidationException {
	if (!binder.isValid()) {
		BasicBinderValidationStatus<BEAN> vs = binder.getValidationStatus();
		throw new ValidationException(vs.getFieldValidationErrors(), vs.getBeanValidationErrors());
	}

	BEAN sourceBean = binder.getBean();
	if (sourceBean == null) {
		return;
	}

	binder.getBindings().stream().forEach(e -> {
		@SuppressWarnings("unchecked")
		Setter<BEAN, Object> setter = (Setter<BEAN, Object>) e.setter;
		if (setter != null) {
			setter.accept(bean, e.getter.apply(sourceBean));
		}
	});
	// Trigger StatusChange (required by Grid editor).
	binder.removeBean();
	binder.setBean(sourceBean);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:24,代码来源:BinderAdapter.java

示例3: bind

import com.vaadin.server.Setter; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public <PRESENTATION, MODEL> EasyBinding<BEAN, PRESENTATION, MODEL> bind(HasValue<PRESENTATION> field,
		String propertyName, Converter<PRESENTATION, ?> converter, boolean readOnly) {
	Objects.requireNonNull(converter);
	Objects.requireNonNull(propertyName, "Property name cannot be null");
	// checkUnbound();

	PropertyDefinition<BEAN, ?> definition = propertySet.getProperty(propertyName)
			.orElseThrow(() -> new IllegalArgumentException(
					"Could not resolve property name " + propertyName + " from " + propertySet));

	ValueProvider<BEAN, ?> getter = definition.getGetter();
	Setter<BEAN, ?> setter = readOnly ? null : definition.getSetter().orElse(null);

	EasyBinding<BEAN, PRESENTATION, MODEL> binding = bind(field, (ValueProvider) getter, (Setter) setter,
			propertyName, (Converter) converter);

	boundProperties.put(propertyName, binding);

	Optional<Field> modelField = getDeclaredFieldByName(definition.getPropertyHolderType(), definition.getName());
	if (Arrays.asList(modelField.get().getAnnotations()).stream().anyMatch(requiredConfigurator)) {
		field.setRequiredIndicatorVisible(true);
	}

	return binding;
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:27,代码来源:ReflectionBinder.java

示例4: EasyBinding

import com.vaadin.server.Setter; //导入依赖的package包/类
public EasyBinding(BasicBinder<BEAN> binder, HasValue<FIELDVALUE> field, ValueProvider<BEAN, TARGET> getter,
		Setter<BEAN, TARGET> setter, String property,
		Converter<FIELDVALUE, TARGET> converterValidatorChain) {
	this.field = field;
	this.getter = getter;
	this.setter = setter;
	this.property = property;
	this.converterValidatorChain = converterValidatorChain;

	registration = field.addValueChangeListener(e -> {
		if (binder.getBean() != null) {
			if (binder.fieldToBean(this)) {
				binder.fireValueChangeEvent(e);
			}
		}
	});

	if (setter == null) {
		field.setReadOnly(true);
	}
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:22,代码来源:BasicBinder.java

示例5: bind

import com.vaadin.server.Setter; //导入依赖的package包/类
public <FIELDVALUE, TARGET> EasyBinding<BEAN, FIELDVALUE, TARGET> bind(HasValue<FIELDVALUE> field,
		ValueProvider<BEAN, TARGET> getter, Setter<BEAN, TARGET> setter, String property,
		Converter<FIELDVALUE, TARGET> converter) {

	Objects.requireNonNull(field);
	Objects.requireNonNull(getter);
	Objects.requireNonNull(converter);

	// Register as binding
	EasyBinding<BEAN, FIELDVALUE, TARGET> binding = new EasyBinding<BEAN, FIELDVALUE, TARGET>(this, field, getter,
			setter, property, converter);

	// TODO: remove from binding
	/*
	 * binding.registration = field.addValueChangeListener(e -> { if (getBean() !=
	 * null) { if(fieldToBean(binding)) { fireValueChangeEvent(e); } } });
	 */

	bindings.add(binding);

	// Add property to validation error map
	if (property != null) {
		propertyToBindingMap.put(property, binding);
	}

	if (getBean() != null) {
		if (fieldToBean(binding)) {
			// TODO: should this be fired?
			// fireValueChangeEvent(e);
		}
	} else {
		fireStatusChangeEvent();
	}

	return binding;
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:37,代码来源:BasicBinder.java

示例6: getSetter

import com.vaadin.server.Setter; //导入依赖的package包/类
@Override
public Optional<Setter<PropertyBox, V>> getSetter() {
	if (property.isReadOnly()) {
		return Optional.empty();
	}
	return Optional.of((pb, value) -> {
		pb.setValue(property, value);
	});
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:10,代码来源:DefaultPropertyListing.java

示例7: bind

import com.vaadin.server.Setter; //导入依赖的package包/类
@Override
public <FIELDVALUE> Binding<BEAN, FIELDVALUE> bind(HasValue<FIELDVALUE> field,
		ValueProvider<BEAN, FIELDVALUE> getter, Setter<BEAN, FIELDVALUE> setter) {
	throw new UnsupportedOperationException("Not supported");
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:6,代码来源:BinderAdapter.java


注:本文中的com.vaadin.server.Setter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。