graphql.schema.PropertyDataFetcher Java Examples

The following examples show how to use graphql.schema.PropertyDataFetcher. 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: VertxPropertyDataFetcher.java    From vertx-web with Apache License 2.0 5 votes vote down vote up
@GenIgnore(PERMITTED_TYPE)
static PropertyDataFetcher<Object> create(String propertyName) {
  return new PropertyDataFetcher<Object>(propertyName) {
    @Override
    public Object get(DataFetchingEnvironment environment) {
      Object source = environment.getSource();
      if (source instanceof JsonObject) {
        JsonObject jsonObject = (JsonObject) source;
        return jsonObject.getValue(getPropertyName());
      }
      return super.get(environment);
    }
  };
}
 
Example #2
Source File: RdfWiringFactory.java    From timbuctoo with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DataFetcher getDefaultDataFetcher(FieldWiringEnvironment environment) {
  return new PropertyDataFetcher(environment.getFieldDefinition().getName());
}