Java Code Examples for org.springframework.data.mapping.PreferredConstructor#Parameter
The following examples show how to use
org.springframework.data.mapping.PreferredConstructor#Parameter .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultNeo4jConverter.java From sdn-rx with Apache License 2.0 | 6 votes |
private <ET> ET instantiate(Neo4jPersistentEntity<ET> nodeDescription, MapAccessor values, KnownObjects knownObjects, Collection<RelationshipDescription> relationships, Collection<String> surplusLabels) { ParameterValueProvider<Neo4jPersistentProperty> parameterValueProvider = new ParameterValueProvider<Neo4jPersistentProperty>() { @Override public Object getParameterValue(PreferredConstructor.Parameter parameter) { Neo4jPersistentProperty matchingProperty = nodeDescription .getRequiredPersistentProperty(parameter.getName()); if (matchingProperty.isRelationship()) { return createInstanceOfRelationships(matchingProperty, values, knownObjects, relationships) .orElse(null); } else if (matchingProperty.isDynamicLabels()) { return createDynamicLabelsProperty(matchingProperty.getTypeInformation(), surplusLabels); } return readValueForProperty(extractValueOf(matchingProperty, values), parameter.getType()); } }; return INSTANTIATORS.getInstantiatorFor(nodeDescription) .createInstance(nodeDescription, parameterValueProvider); }
Example 2
Source File: RowParameterValueProvider.java From vertx-spring-boot with Apache License 2.0 | 5 votes |
@Override public <T> T getParameterValue(PreferredConstructor.Parameter<T, RelationalPersistentProperty> parameter) { RelationalPersistentProperty property = entity.getRequiredPersistentProperty(parameter.getName()); Object value = row.getValue(property.getColumnName()); Class<T> type = parameter.getRawType(); return convertIfNecessary(value, type); }