MCPcopy Index your code
hub / github.com/JodaOrg/joda-convert

github.com/JodaOrg/joda-convert @v3.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.1 ↗ · + Follow
717 symbols 1,935 edges 93 files 179 documented · 25% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Joda-Convert

Joda-Convert is a small, highly-focussed library, tackling a problem that the JDK should solve - providing round-trip conversion between Objects and Strings. It is not intended to tackle the wider problem of Object to Object transformation.

// conversion to String
String str = StringConvert.INSTANCE.convertToString(foo);

// conversion from String
Foo bar = StringConvert.INSTANCE.convertFromString(Foo.class, str);

Joda-Convert supports two mechanisms of extending the list of supported conversions. The first is to write your own converter implementing an interface. The second is to use annotations.

The ability of Joda-Convert to use annotations to define the conversion methods is a key difference from other projects. For example, most value classes, like Currency or TimeZone, already have methods to convert to and from a standard format String. Consider a Distance class annotated with FromString and ToString:

public class Distance {

  @FromString
  public static Distance parse(String str) { ... }

  @ToString
  public String getStandardOutput() { ... }

}

As shown, the two methods may have any name. They must simply fulfil the required method signatures for conversion. The FromString annotation may also be applied to a constructor.

When Joda-Convert is asked to convert between an object and a String, if there is no registered converter then the annotations are checked. If they are found, then the methods are called by reflection.

Joda-Convert is licensed under the business-friendly Apache 2.0 licence.

Documentation

Various documentation is available:

Releases

The 3.x branch is compatible with Java SE 21 or later.

The 2.x branch is compatible with Java SE 6 or later.

v2.x releases are compatible with v1.x releases, with the exception that the direct Guava dependency is removed. v3.x releases are compatible with v2.x releases, however the module-info.class file is always present, and the oldest development pre-release of JSR-310 is not recognized.

Joda-Convert has no dependencies.

Available in the Maven Central repository. GitHub release bundles.

Tidelift dependency check

For enterprise

Available as part of the Tidelift Subscription.

Joda and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.

If you want the flexibility of open source and the confidence of commercial-grade software, this is for you.

Learn more

Support

Please use Stack Overflow for general usage questions. GitHub issues and pull requests should be used when you want to help advance the project.

Any donations to support the project are accepted via OpenCollective.

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Release process

  • Update info (index.md, changes.xml)
  • Commit and push
  • mvn clean release:clean release:prepare release:perform
  • git fetch
  • Website will be built and released by GitHub Actions

Extension points exported contracts — how you extend this code

Test1Interface (Interface)
Example interface with annotated methods. [27 implementers]
src/test/java/org/joda/convert/test1/Test1Interface.java
StringConverterFactory (Interface)
Factory for StringConverter that allows converters to be created dynamically or easily initialised. Implemen [21 implementers]
src/main/java/org/joda/convert/StringConverterFactory.java
Test4Interface (Interface)
Example interface with annotated methods. [27 implementers]
src/test/java/org/joda/convert/test4/Test4Interface.java
TypedFromStringConverter (Interface)
Interface defining conversion from a String together with the type. TypedFromStringConverter is an interface [8 implementers]
src/main/java/org/joda/convert/TypedFromStringConverter.java
Test3Interface (Interface)
Example interface with annotated methods. [45 implementers]
src/test/java/org/joda/convert/test3/Test3Interface.java
ToStringConverter (Interface)
Interface defining conversion to a String. ToStringConverter is an interface and must be implemented with ca [7 implementers]
src/main/java/org/joda/convert/ToStringConverter.java
Test2Interface (Interface)
Example interface with annotated methods. [27 implementers]
src/test/java/org/joda/convert/test2/Test2Interface.java
FromStringConverter (Interface)
Interface defining conversion from a String. FromStringConverter is an interface and must be implemented wit [9 implementers]
src/main/java/org/joda/convert/FromStringConverter.java

Core symbols most depended-on inside this repo

toString
called by 52
src/test/java/org/joda/convert/test3/Test3Interface.java
convertToString
called by 50
src/main/java/org/joda/convert/StringConvert.java
convertFromString
called by 47
src/main/java/org/joda/convert/FromStringConverter.java
findConverter
called by 44
src/main/java/org/joda/convert/StringConvert.java
convertToString
called by 42
src/main/java/org/joda/convert/ToStringConverter.java
convertFromString
called by 38
src/main/java/org/joda/convert/StringConvert.java
equals
called by 35
src/main/java/org/joda/convert/Types.java
getEffectiveType
called by 26
src/main/java/org/joda/convert/TypedStringConverter.java

Shape

Method 601
Class 81
Enum 24
Interface 11

Languages

Java100%

Modules by API surface

src/test/java/org/joda/convert/TestStringConvert.java102 symbols
src/main/java/org/joda/convert/Types.java73 symbols
src/test/java/org/joda/convert/TestJDKStringConverters.java64 symbols
src/main/java/org/joda/convert/JDKStringConverter.java31 symbols
src/main/java/org/joda/convert/StringConvert.java29 symbols
src/main/java/org/joda/convert/factory/NumericObjectArrayStringConverterFactory.java24 symbols
src/main/java/org/joda/convert/factory/NumericArrayStringConverterFactory.java24 symbols
src/test/java/org/joda/convert/TestGuavaTypeTokenStringConverter.java19 symbols
src/main/java/org/joda/convert/RenameHandler.java17 symbols
src/main/java/org/joda/convert/AnnotationStringConverterFactory.java12 symbols
src/test/java/org/joda/convert/TestStringConverterFactory.java9 symbols
src/main/java/org/joda/convert/TypeStringConverterFactory.java9 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add joda-convert \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact