source: java/main/src/main/java/com/framsticks/core/ListChange.java @ 85

Last change on this file since 85 was 85, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • upgrade to Java 7
    • use try-multi-catch clauses
    • use try-with-resources were appropriate
  • configure FindBugs? (use mvn site and then navigate in browser to the report)
    • remove most bugs found
  • parametrize Dispatching environment (Dispatcher, RunAt?) to enforce more control on the place of closures actual call

CHANGELOG:
Rework FavouritesXMLFactory.

FindBugs?. Thread start.

FindBugs?. Minor change.

FindBugs?. Iterate over entrySet.

FindBugs?. Various.

FindBug?.

FindBug?. Encoding.

FindBug?. Final fields.

FindBug?.

Remove synchronization bug in ClientConnection?.

Experiments with findbugs.

Finish parametrization.

Make RunAt? an abstract class.

More changes in parametrization.

More changes in parametrizing dispatching.

Several changes to parametrize tasks.

Rename Runnable to RunAt?.

Add specific framsticks Runnable.

Add JSR305 (annotations).

Add findbugs reporting.

More improvements to ParamBuilder? wording.

Make FramsClass? accept also ParamBuilder?.

Change wording of ParamBuilder?.

Change wording of Request creation.

Use Java 7 exception catch syntax.

Add ScopeEnd? class.

Upgrade to Java 7.

File size: 1.6 KB
Line 
1package com.framsticks.core;
2
3import com.framsticks.params.FramsClass;
4import com.framsticks.params.Param;
5import com.framsticks.params.types.DecimalParam;
6import com.framsticks.params.types.EnumParam;
7import com.framsticks.params.types.StringParam;
8import com.framsticks.util.lang.Strings;
9
10import java.util.Arrays;
11
12/**
13 * @author Piotr Sniegowski
14 */
15public class ListChange {
16
17        public Action getAction() {
18                return action;
19        }
20
21        public Integer getPosition() {
22                return position;
23        }
24
25        public String getIdentifier() {
26                return identifier;
27        }
28
29        public static enum Action {
30                Add,
31                Remove,
32                Modify
33        }
34
35        private Action action;
36        private Integer position;
37        private String identifier;
38
39        public Integer getType() { return action.ordinal(); }
40        public void setType(Integer type) { action = Action.values()[type]; }
41
42        public Integer getPos() { return position; }
43        public void setPos(Integer pos) { position = pos; }
44
45        public String getId() { return identifier; }
46        public void setId(String id) { identifier = id; }
47
48        public String getBestIdentifier() {
49                if (Strings.notEmpty(identifier)) {
50                        return identifier;
51                }
52                return position.toString();
53        }
54
55        public static FramsClass getFramsClass() {
56                return new FramsClass("ListChange", "ListChange", null)
57                                .append(Param.build().id("type").name("type").type(new EnumParam(Arrays.asList("Add", "Remove", "Modify"))))
58                                .append(Param.build().id("id").name("identifier").type(StringParam.class))
59                                .append(Param.build().id("pos").name("position").type(DecimalParam.class));
60        }
61
62        @Override
63        public String toString() {
64                return action + " " + identifier + " " + position;
65        }
66}
Note: See TracBrowser for help on using the repository browser.