Comments (4)
See SpdxFile for an example of the builder pattern. This pattern was introduced late in the development of the library. It would be nice to add this to some of the license classes that were implemented previously.
from spdx-java-library.
Hi @goneall, I have begun some work on this here. I'll add documentation and tests for this and then proceed to find other possible use cases for builders. Do you have more such cases for using builders in mind ?
Also, I felt a little awkward while adding the builder. The large number of possible arguments make sense for adding the Builder but having multiple public constructors in addition to it make the API of the class a bit confusing. It would be interesting to explore if the public constructors can be replaced with static factory methods for common use cases.
from spdx-java-library.
Hi @amCap1712 Thanks for taking this on.
One suggestion - In the other classes that use builders, I used a slightly different pattern where the builder is passed in as a parameter to a constructor for the class rather than having a method which returns the instantiated class from the builder itself (see
)Either (or both) approach is fine, but for consistency I would like to pass the builder in as a constructor.
Also, I felt a little awkward while adding the builder. The large number of possible arguments make sense for adding the Builder but having multiple public constructors in addition to it make the API of the class a bit confusing. It would be interesting to explore if the public constructors can be replaced with static factory methods for common use cases.
There may be some compatibility considerations for code which is already using these constructors. That being said, simplifying the code would definitely be a good thing and I would be interested in your proposal and thoughts.
Note that there are a lot of helper methods in ModelObject to create the model objects - I think this will be the dominant use case with the other constructors just being around for compatibility.
See
from spdx-java-library.
I agree with you regarding the compatibility restraints. I noticed the library is still 0.6. I am not aware of how widely it is used and the status section in the README says that it is under development. If the library is mostly used in other SPDX projects, it might be easier to make an incompatible change.
For now, I'll just add the builder and be consistent with the other parts of the code. Later, once I am more familiar with the project, I'll try to come back to this and see if we have some room for improvement here.
from spdx-java-library.
Related Issues (20)
- Update POM file to use release plugin HOT 1
- Enhancement: caching version of org.spdx.storage.listedlicense.SpdxListedLicenseWebStore and associated classes HOT 27
- tools-java should issue an error for absolute FileName HOT 5
- Need to update optional fields handling for cases with filesAnalyzed=true HOT 2
- Do we have a release schedule? HOT 4
- Performance enhancement: only download and parse license & exception JSON files once
- Exceptions aren't always passed on, making troubleshooting difficult
- Update CI to flag any new quality issues
- LicenseCompareHelper: EPL-2.0 license text published by Eclipse Foundation not recognised HOT 3
- LicenseCompareHelper: BSD-2-Clause license text not recognised HOT 2
- In need of a canonical way to add license texts for licenseRefs / Maybe bugged? HOT 4
- LicenseCompareHelper: GPL-2.0 license text not recognised HOT 2
- Question HOT 2
- Refactor nonOptionalTextToPatterns HOT 2
- Verify error when license exceptions are used in an expression in LicenseConcluded but not in LicenseInfoInFile HOT 2
- Official Apache-1.1 license text is not being matched correctly by LicenseCompareHelper.matchingStandardLicenseIdsWithinText() HOT 1
- Official GPL-1.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 1
- Potential enhancement: LicenseCompareHelper.isTextStandardLicense().getDifferenceMessage() should sort by line then column
- Official CC-BY-4.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 3
- Inconsistent behaviour between LicenseCompareHelper methods when called with official MIT license text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdx-java-library.