Giter Club home page Giter Club logo

uri-toolkit's People

Contributors

dmfs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

uri-toolkit's Issues

Parametrized list of pairs

In order to generate a Parametrized instance (to build a Query or a Fragment), as a developer, I want a Parametrized adapter class that takes a list of Pairs.


The idea is to be able to create a Parametrized like so:

Param<CharSequence> p = new TextParam("query");
Param<Integer> c = new IntegerParam("count");

Parametrized<UriEncoded, UriEncoded> params =
    new ParametrizedPairs(p.param("query value"), c.param(1234));

which would result in a query like query=query+value&count=1234.

dedicated support for geo URIs

In order to create geo URIs in a convenient manner, as a user of this library, I wand a GeoUri class that represents a geo URI as per RFC5870.

At present we have no GeoLocation object so we should go with constructors like

   GeoUri(double coordA, double coordB, double coordC, CharSequence crs, double uncertainty); 
   GeoUri(double coordA, double coordB); 
   GeoUri(double coordA, double coordB, double uncertainty); 

Proper implementation of equals(Object) and hashCode()

In order to be able to check Uris (and their components) for equality and put them into Sets or use them as keys in a Map, as a developer I want proper support for equals(Object) and hashCode().


Before we can approach this we need to define the correct behavior. For instance as per RFC 3986, two URIs are considered to represent the same resource if their normalized forms are equal. What does this mean with respect to equals(Object)? Should we normalize the Uris before we compare them or do we leave that to the developer?

In general this could potentially result in a lot of duplicate code, if every implementation has its own equals(Object) and hashCode() methods. So the idea is to create decorators or adapters that add the ability to use equals(Object) and hashCode(). Something like new Hashable(uri) or new Equalable(uri). However since all other objects still have a default implementation of these methods a developer could easily do it wrong without noticing. The current idea to handle this is to throw an UnsupportedOperationException in equals(Object) and hashCode() of objects which do not support hashing and comparison. The behavior would be similar to adding non-hashable objects to a set in Python. This could be achieved by inheriting from an abstract base object class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.