Skip to content

Commit

Permalink
move getFieldType to a default interface method
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro93 committed Oct 24, 2023
1 parent 62b8f6a commit 51c60bc
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public class DataPlatformInstanceFieldResolverProvider implements EntityFieldRes
private final EntityClient _entityClient;
private final Authentication _systemAuthentication;

@Override
public EntityFieldType getFieldType() {
return EntityFieldType.DATA_PLATFORM_INSTANCE;
}

@Override
public List<EntityFieldType> getFieldTypes() {
return Collections.singletonList(EntityFieldType.DATA_PLATFORM_INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public class DomainFieldResolverProvider implements EntityFieldResolverProvider
private final EntityClient _entityClient;
private final Authentication _systemAuthentication;

@Override
public EntityFieldType getFieldType() {
return EntityFieldType.DOMAIN;
}

@Override
public List<EntityFieldType> getFieldTypes() {
return Collections.singletonList(EntityFieldType.DOMAIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public interface EntityFieldResolverProvider {
/**
* Field that this hydrator is hydrating
*/
EntityFieldType getFieldType();
default EntityFieldType getFieldType() {
return this.getFieldTypes().get(0);
}

/**
* List of fields that this hydrator is hydrating.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
* Provides field resolver for entity type given entitySpec
*/
public class EntityTypeFieldResolverProvider implements EntityFieldResolverProvider {
@Override
public EntityFieldType getFieldType() {
return getFieldTypes().get(0);
}

@Override
public List<EntityFieldType> getFieldTypes() {
return ImmutableList.of(EntityFieldType.RESOURCE_TYPE, EntityFieldType.TYPE);
return ImmutableList.of(EntityFieldType.TYPE, EntityFieldType.RESOURCE_TYPE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
* Provides field resolver for entity urn given entitySpec
*/
public class EntityUrnFieldResolverProvider implements EntityFieldResolverProvider {
@Override
public EntityFieldType getFieldType() {
return EntityFieldType.URN;
}

@Override
public List<EntityFieldType> getFieldTypes() {
return ImmutableList.of(EntityFieldType.RESOURCE_URN, EntityFieldType.URN);
return ImmutableList.of(EntityFieldType.URN, EntityFieldType.RESOURCE_URN);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public class GroupMembershipFieldResolverProvider implements EntityFieldResolver
private final EntityClient _entityClient;
private final Authentication _systemAuthentication;

@Override
public EntityFieldType getFieldType() {
return EntityFieldType.GROUP_MEMBERSHIP;
}

@Override
public List<EntityFieldType> getFieldTypes() {
return Collections.singletonList(EntityFieldType.GROUP_MEMBERSHIP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public class OwnerFieldResolverProvider implements EntityFieldResolverProvider {
private final EntityClient _entityClient;
private final Authentication _systemAuthentication;

@Override
public EntityFieldType getFieldType() {
return EntityFieldType.OWNER;
}

@Override
public List<EntityFieldType> getFieldTypes() {
return Collections.singletonList(EntityFieldType.OWNER);
Expand Down

0 comments on commit 51c60bc

Please sign in to comment.