-
Notifications
You must be signed in to change notification settings - Fork 2.7k
extract common functionality of DefaultPluginXmlFactory #2326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
c99650c
to
b9ac82d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It really does not make any sense to me to wrap the request (immutable data object) into another object, just for the sake of having methods collocated with the data.
https://refactoring.guru/design-patterns/factory-method Considering factory adhering to creational design pattern its supposed to
yes this is considered OOP, IoC, SRP, and SOC avoiding the Grouping data and its entourage; companion into dedicated classified dimensions.
When this factory is handling 100 products im sure they wont all gather inside on place. |
we can inline of course and least separate code on impl lvl giving each dedicated concern. Imho considering SOLID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointing out dedicated concerns.
Raising question about factory name and design as still factory is only creational pattern, having to delegate like everybody else following SOLID.
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/ReadRequest.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/ReadRequest.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/ReadRequest.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
sacrifice/spike architectural design again, in sake to increment code. |
feature envy
in DefaultPluginXmlFactory
feature envy
of DefaultPluginXmlFactory
5b450eb
to
0d2a242
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request feedback.
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Outdated
Show resolved
Hide resolved
0d2a242
to
19f4281
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definite no: 3 classes to implement 2 methods is a no go for me.
feature envy
of DefaultPluginXmlFactory
feature envy
of DefaultPluginXmlFactory
leveraging OOP
19f4281
to
cd34ecf
Compare
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterRequest.java
Outdated
Show resolved
Hide resolved
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterRequest.java
Show resolved
Hide resolved
09692d4
to
8f0ee61
Compare
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Outdated
Show resolved
Hide resolved
8f0ee61
to
9bfb35c
Compare
f16df2e
to
8410e6b
Compare
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Show resolved
Hide resolved
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java
Outdated
Show resolved
Hide resolved
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterRequest.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Outdated
Show resolved
Hide resolved
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterRequest.java
Outdated
Show resolved
Hide resolved
SPOT
for DefaultPluginXmlFactory
leveraging OOP
SPOT
to DefaultPluginXmlFactory
leveraging OOP
SPOT
to DefaultPluginXmlFactory
leveraging OOP
SPOT
to DefaultPluginXmlFactory
cure feature envy
leveraging OOP
8410e6b
to
3d0d18b
Compare
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java
Outdated
Show resolved
Hide resolved
SPOT
to DefaultPluginXmlFactory
cure feature envy
leveraging OOP
SPOT
to DefaultPluginXmlFactory
cure feature envy
leverage OOP
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Outdated
Show resolved
Hide resolved
3d0d18b
to
33830ea
Compare
impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
Show resolved
Hide resolved
c09f7ee
to
6333f01
Compare
@@ -84,7 +84,7 @@ private Model doRead(XmlReaderRequest request) throws XmlReaderException { | |||
Reader reader = request.getReader(); | |||
InputStream inputStream = request.getInputStream(); | |||
if (path == null && url == null && reader == null && inputStream == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use oop.
6333f01
to
7cf25e2
Compare
} | ||
|
||
@Override | ||
public void write(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a factory not
creating anything, seems kind of goofy:

This seems more service, then factory layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kindly request critic.
} | ||
|
||
@Override | ||
public void write(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public void write(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException { | |
public void request(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException { |
might have generic request
name propagate overload, as type seems enough to determine.
import static org.apache.maven.impl.StaxLocation.getLocation; | ||
import static org.apache.maven.impl.StaxLocation.getMessage; | ||
|
||
@Named | ||
@Singleton | ||
public class DefaultPluginXmlFactory implements PluginXmlFactory { | ||
|
||
@Override | ||
public PluginDescriptor read(@Nonnull XmlReaderRequest request) throws XmlReaderException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public PluginDescriptor read(@Nonnull XmlReaderRequest request) throws XmlReaderException { | |
public PluginDescriptor request(@Nonnull XmlReaderRequest request) throws XmlReaderException { |
might have generic request
name propagate overload, as type seems enough to determine.
@@ -78,6 +78,12 @@ interface Transformer { | |||
String transform(String source, String fieldName); | |||
} | |||
|
|||
default void assertReadable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verifyReadable as assert typically means something a little different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider generic throwIfIncomplete
for both, as its kind of same use case.
Yes, ensure might fit better. Sent from my iPhoneOn 16 May 2025, at 13:00, Elliotte Rusty Harold ***@***.***> wrote:
@elharo commented on this pull request.
In api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java:
@@ -78,6 +78,12 @@ interface Transformer {
String transform(String source, String fieldName);
}
+ default void assertReadable() {
verifyReadable as assert typically means something a little different
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
7cf25e2
to
d36ef1d
Compare
SPOT
to DefaultPluginXmlFactory
cure feature envy
leverage OOP
d36ef1d
to
a1d7bb0
Compare
Give
SPOT
forDefaultPluginXmlFactory
leveragingOOP
outputStream
destination;request
instead ofpath
inDefaultPluginXmlFactory#write
#2312