[jira] [Commented] (PIVOT-1045) Refactor read-only classes to use a common abstract class to reduce code

2019-08-12 Thread Roger Whitcomb (JIRA)


[ 
https://issues.apache.org/jira/browse/PIVOT-1045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16905665#comment-16905665
 ] 

Roger Whitcomb commented on PIVOT-1045:
---

Other candidates include:
 * CalendarDateSpinnerData
 * QueryServlet.Path
 * ResultList
 * FileObjectList ( ? )
 * FileList ( ? ) (these two are not completely read-only but only allow "add")
 * Sequence.ImmutablePath

Other things that could be looked at:
 * The immutable list has other methods (such as "clear()" that are not 
allowed, so we could build a second base class for those) (see EnumList also)
 * ImmutableSet has a slightly different set of disallowed operations, so we 
could build ReadOnlySet  maybe...
 * ImmutableMap could be looked at too.
 * EnumSet and EnumMap look a lot like these "Immutable" variants, so 
 * BeanAdapter has a bunch of unsupported operations:  is this a candidate also 
for a base class?

> Refactor read-only classes to use a common abstract class to reduce code
> 
>
> Key: PIVOT-1045
> URL: https://issues.apache.org/jira/browse/PIVOT-1045
> Project: Pivot
>  Issue Type: Improvement
>  Components: core-collections
>Reporter: Roger Whitcomb
>Assignee: Roger Whitcomb
>Priority: Minor
>
> All of the "read-only" collection classes (such as ArrayAdapter, EnumList, 
> ImmutableList) share the concept that "add", "insert", "remove", etc. all 
> throw exceptions because they are unsupported in a read-only collection. It 
> would reduce code and expose the common functionality if they were all 
> implemented on top of a single abstract class that provides a uniform 
> implementation of these unsupported methods.
> I propose to implement a ReadOnlySequence class that does this and refactor 
> all other existing places (at least) with the common subclass.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (PIVOT-1045) Refactor read-only classes to use a common abstract class to reduce code

2019-08-12 Thread Roger Whitcomb (JIRA)


[ 
https://issues.apache.org/jira/browse/PIVOT-1045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16905627#comment-16905627
 ] 

Roger Whitcomb commented on PIVOT-1045:
---

First iteration:

Sending core\src\org\apache\pivot\collections\ArrayAdapter.java
Sending core\src\org\apache\pivot\collections\ArrayList.java
Sending core\src\org\apache\pivot\collections\EnumList.java
Adding core\src\org\apache\pivot\collections\ReadOnlySequence.java
Sending core\src\org\apache\pivot\collections\immutable\ImmutableList.java
Sending core\test\org\apache\pivot\collections\test\ArrayListTest.java
Sending wtk\src\org\apache\pivot\wtk\content\NumericSpinnerData.java
Transmitting file data ...done
Committing transaction...
Committed revision 1864990.

> Refactor read-only classes to use a common abstract class to reduce code
> 
>
> Key: PIVOT-1045
> URL: https://issues.apache.org/jira/browse/PIVOT-1045
> Project: Pivot
>  Issue Type: Improvement
>  Components: core-collections
>Reporter: Roger Whitcomb
>Assignee: Roger Whitcomb
>Priority: Minor
>
> All of the "read-only" collections (such as ArrayAdapter, EnumList, 
> ImmutableList) share the concept that "add", "insert", "remove", etc. all 
> throw an exception because they are unsupported in a read-only collection. It 
> would reduce code and expose the common functionality if they were all 
> implemented on top of a single abstract class the provides a uniform 
> implementation of these unsupported methods.
> I propose to implement a ReadOnlySequence class that does this and refactor 
> all other existing places (at least) with the common subclass.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)