2
votes
2answers
63 views

Converting string with a lot of if statement

I have code like the following one, which I use to convert string to another string. public String convertString(String string) { String convertedString = string; if( string.contains("something")) ...
2
votes
3answers
89 views

Design Strategy of CSV Parser

I wanted to review my design strategy for CSV parser. I have 4 CSV files, which have different layouts as shown below. Each row of a CSV file will be mapped to a class. For example, if CSV_FILE_A has ...
2
votes
1answer
92 views

Review of simple Java Actor library

How can I improve this code? Also available from git://github.com/edescourtis/actor.git . Actor.java package com.benbria.actor; public interface Actor<T> extends Runnable { public ...
-1
votes
1answer
113 views

please review my switch case code

Now I hava a enum param and wants to do something which is acording to the enum param value. While the enum param is too much and my method will become too long.How can I refactor my code? I know ...
0
votes
1answer
68 views

Q&A system model design [closed]

Now I am trying to build a Q&A website by myself.The models below is my model design.I have some questions about this. 1、class Category: public class Category { private String name; } ...
0
votes
1answer
61 views

how do I encapsulate this List<Message> properly?

I know that Swing isn't true MVC: Using this modified MVC helps to more completely decouple the model from the view. Leaving aside the veracity of the above claim, the problem I run into is ...
1
vote
1answer
34 views

Opinions on my Command pattern design - is it extensible?

I am implementing a program that takes commands from a user and based on those commands, drives a Robot on a grid. To implement this program I have used the Command pattern. I have used this pattern ...
0
votes
0answers
33 views

immutable metadata constructor access

I want an immutable class, and the constructor should be package private. However, it ends up getting used outside the package: package gnu.mail.providers.nntp; import gnu.inet.nntp.GroupResponse; ...
1
vote
0answers
22 views

Is this a good approach for a BayeuxClient class?

Is this a good approach for a BayeuxClient class? Reading cometd reference book, Chapter 6 Java Libraries, I created this BayeuxClient class. As a newbie to cometd, I would like to know if this ...
4
votes
2answers
141 views

Is this a correct way to use Factory Pattern?

I have an abstract class which implements the IDataCreator interface: public interface IDataCreator { public String getDataString(); } public abstract class AbstractCreator implements ...
2
votes
1answer
81 views

Observer pattern in Java

I'm going to have a lot of integer values, and at any value change I might need to update any number of UI elements, other values which are computed from the first ones, etc. Sounds like time for the ...
2
votes
1answer
79 views

Design Pattern for Swing application

I have a Swing application with no real design pattern. I want to start learning to design Swing or any types of application properly. Here is the main JFrame class. import java.awt.Component; ...
4
votes
2answers
99 views

Move object by one up or down algorithm in a custom order

Basically, I did an object (using hibernate) with a field called sorting_order. This field needs to be unique and I wish to swap two object by one. So one element has to be after or before the current ...
2
votes
1answer
86 views

Using AbstractFactory

I am a newcomer to design patterns. I read some articles about the abstract factory pattern, and wrote the following simple example: public interface ParserFactory { List<ITransport> ...
-1
votes
1answer
98 views

design classes for a JAVA swing application [closed]

I am very new in making JAVA swing applications.. My problem statement is to make a library management application,for which i designed classes as below. Please tell me whether my design of classes ...

1 2 3 4
15 30 50 per page