dmfs / uri-toolkit Goto Github PK
View Code? Open in Web Editor NEWAn RFC 3986 compliant Java URI implementation.
License: Apache License 2.0
An RFC 3986 compliant Java URI implementation.
License: Apache License 2.0
WwwFormUrlEncoded uses %20 to encode spaces when it should use "+".
Also it doesn't normalize new line sequences.
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 Pair
s.
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
.
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);
The Optional interface now has its own project at dmfs/optional.
This constructor is currently missing.
Java 21 has a new String Template feature in preview. This could serve as the basis to generate URIs from URI templates or something alike
In order to be able to check Uri
s (and their components) for equality and put them into Set
s 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 Uri
s 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.
See comment at:
schedjoules/android-event-discovery-sdk#331 (comment)
public final class JavaUri implements Uri
{
private final Uri mDelegate;
public JavaUri(URI javaNetUri)
{
mDelegate = new LazyUri(new Precoded(javaNetUri.toString()));
}
... delegations
javaNetUri.toString()
could be replace with new ToStringCharSequence(javaNetUri)
where ToStringCharSequence
takes any Object
and delegates to toString()
string lazily.
Maybe remove direct dependency for iterators
as optional
uses it anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.