
org.eclipse.jnosql.lite.mapping.entities.JobCityFieldMetaData Maven / Gradle / Ivy
/*
* Copyright (c) 2023 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.eclipse.jnosql.lite.mapping.entities;
import java.lang.annotation.Annotation;
import org.eclipse.jnosql.communication.Value;
import org.eclipse.jnosql.mapping.AttributeConverter;
import org.eclipse.jnosql.mapping.metadata.FieldMetadata;
import org.eclipse.jnosql.mapping.metadata.MappingType;
import javax.annotation.processing.Generated;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@Generated(value= "JNoSQL Lite FieldMetadata Generator", date = "2023-12-02T14:20:40.631490737")
public final class JobCityFieldMetaData implements FieldMetadata {
private final AttributeConverter, ?> converter;
private final Class extends AttributeConverter, ?>> typeConverter;
private final Map, String> valueByAnnotation;
public JobCityFieldMetaData() {
this.converter = null;
this.typeConverter = null;
this.valueByAnnotation = java.util.Collections.emptyMap();
}
@Override
public boolean isId() {
return false;
}
@Override
public Optional value(Class type) {
Objects.requireNonNull(type, "type is required");
return Optional.ofNullable(this.valueByAnnotation.get(type));
}
@Override
public > Optional> converter() {
return Optional.ofNullable((Class) typeConverter);
}
@Override
public > Optional newConverter() {
return (Optional) Optional.ofNullable(converter);
}
@Override
public MappingType mappingType() {
return MappingType.DEFAULT;
}
@Override
public String name() {
return "city";
}
@Override
public String fieldName() {
return "city";
}
@Override
public Object value(Value value) {
Objects.requireNonNull(value, "value is required");
return value.get(java.lang.String.class);
}
@Override
public void write(Object bean, Object value) {
((Job) bean).setCity((java.lang.String)value);
}
@Override
public Object read(Object bean) {
return ((Job) bean).getCity();
}
@Override
public Class> type() {
return java.lang.String.class;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy