use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class ConstantPoolTest method sameValue_sameId.
@Test
public void sameValue_sameId() {
ConstantPoolKey reference = new ConstantPoolKey(Json.createObject());
String constantId = constantPool.getConstantId(reference);
constantPool.dumpConstants();
String otherId = constantPool.getConstantId(new ConstantPoolKey(Json.createObject()));
Assert.assertEquals(constantId, otherId);
Assert.assertFalse(constantPool.hasNewConstants());
}
use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class ConstantPoolTest method differentValue_differentId.
@Test
public void differentValue_differentId() {
ConstantPoolKey reference = new ConstantPoolKey(Json.createObject());
String constantId = constantPool.getConstantId(reference);
constantPool.dumpConstants();
String otherId = constantPool.getConstantId(new ConstantPoolKey(Json.createArray()));
Assert.assertNotEquals(constantId, otherId);
Assert.assertTrue(constantPool.hasNewConstants());
}
use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class ElementListenerMap method updateEventSettings.
private void updateEventSettings(String eventType) {
Map<String, ExpressionSettings> eventSettings = collectEventExpressions(eventType);
JsonObject eventSettingsJson = JsonUtils.createObject(eventSettings, ExpressionSettings::toJson);
ConstantPoolKey constantPoolKey = new ConstantPoolKey(eventSettingsJson);
put(eventType, constantPoolKey);
}
use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class PolymerServerEventHandlersTest method extractParametersData.
private JreJsonArray extractParametersData(Method method) {
ConstantPoolKey parametersData = (ConstantPoolKey) stateNode.getFeature(PolymerEventListenerMap.class).get(method.getName());
assertNotNull(parametersData);
JsonObject json = Json.createObject();
parametersData.export(json);
return json.get(parametersData.getId());
}
use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class TemplateMap method setModelDescriptor.
/**
* Sets the descriptor of the model type used by this template.
*
* @param modelDescriptor
* the model descriptor to set, not <code>null</code>
*/
public void setModelDescriptor(ModelDescriptor<?> modelDescriptor) {
assert modelDescriptor != null;
assert !contains(NodeProperties.MODEL_DESCRIPTOR);
this.modelDescriptor = modelDescriptor;
put(NodeProperties.MODEL_DESCRIPTOR, new ConstantPoolKey(modelDescriptor.toJson()));
}
Aggregations