roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Mazza (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ROL-1997) Switch WeblogEntry's pub status fields (DRAFT, PUBLISHED, PENDING, SCHEDULED) to an enum type
Date Thu, 19 Jun 2014 02:51:24 GMT

    [ https://issues.apache.org/jira/browse/ROL-1997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14036882#comment-14036882
] 

Glen Mazza commented on ROL-1997:
---------------------------------

Hi Greg, I'm unclear about your point -- you first say that enums would make life more difficult,
but then you say "I find enums are useful for shuffling around parameter checks and alike,
as they have no "real" value?"  (i.e., that they're useful), so I'm a little confused.   


Enum types can be initialized with numeric values, if helpful (from http://howtodoinjava.com/2012/12/07/guide-for-understanding-enum-in-java/):


enum Direction {
	// Enum types
	EAST(0), WEST(180), NORTH(90), SOUTH(270);
	// Constructor
	private Direction(final int angle) {
		this.angle = angle;
	}
	// Internal state
	private int angle;

	public int getAngle() {
		return angle;
	}
}

Otherwise I'm just following Joshua Bloch's Effective Java book recommendations, which is
to prefer enums over numeric constants.  Note I haven't analyzed the full programmatic implication
of switching to enums, I just thought the code would look more tidy as a result.

> Switch WeblogEntry's pub status fields (DRAFT, PUBLISHED, PENDING, SCHEDULED) to an enum
type
> ---------------------------------------------------------------------------------------------
>
>                 Key: ROL-1997
>                 URL: https://issues.apache.org/jira/browse/ROL-1997
>             Project: Apache Roller
>          Issue Type: Task
>            Reporter: Glen Mazza
>            Assignee: Roller Unassigned
>            Priority: Minor
>
> ...and have that enum type used for the get/setStatus() in WeblogEntrySearchCriteria.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message