Skip to content

Commit

Permalink
feat: remove field reflection at field metadadta
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jul 30, 2023
1 parent fcd88a5 commit c072b46
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ public MappingType mappingType() {
return type;
}

@Override
public Field nativeField() {
return field;
}

@Override
public String name() {
return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.eclipse.jnosql.communication.Value;
import org.eclipse.jnosql.mapping.AttributeConverter;

import java.lang.reflect.Field;
import java.util.Optional;

/**
Expand All @@ -36,15 +35,6 @@ public interface FieldMetadata {
*/
MappingType mappingType();

/**
* The {@link Field}
*
* @return the field
*/
default Field nativeField() {
return null;
}

/**
* Returns a {@code Class} object that identifies the
* declared type for the field represented by this
Expand Down Expand Up @@ -83,9 +73,9 @@ default Field nativeField() {

/**
* Returns the Java Fields name.
* {@link Field#getName()}
* {@link java.lang.reflect.Field#getName()}
*
* @return The Java Field name {@link Field#getName()}
* @return The Java Field name {@link java.lang.reflect.Field#getName()}
*/
String fieldName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ private boolean isEmbeddableField() {
}

private boolean hasFieldAnnotation(Class<?> annotation) {
return ((Class) ((ParameterizedType) nativeField()
return ((Class) ((ParameterizedType) this.field
.getGenericType())
.getActualTypeArguments()[0])
.getAnnotation(annotation) != null;
}

public Class<?> elementType() {
return (Class<?>) ((ParameterizedType) nativeField()
return (Class<?>) ((ParameterizedType) this.field
.getGenericType())
.getActualTypeArguments()[0];
}

public Collection<?> collectionInstance() {
Class<?> type = nativeField().getType();
Class<?> type = type();
final CollectionSupplier supplier = ServiceLoader.load(CollectionSupplier.class)
.stream()
.map(ServiceLoader.Provider::get)
Expand Down

0 comments on commit c072b46

Please sign in to comment.