Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package com.sporniket.libre.javabeans.generator.core;
  
Extended information for a property type starting with "enum:..."

© Copyright 2012-2013 David Sporn


This file is part of The Sporniket Javabeans Library – core.

The Sporniket Javabeans Library – core is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Sporniket Javabeans Library – core is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with The Sporniket Javabeans Library – core. If not, see http://www.gnu.org/licenses/. 2


Author(s):
David SPORN
Version:
13.01.01
Since:
13.01.01
 
 public class PropertyTypeEnum extends PropertyType
 {
 
 	public PropertyTypeEnum()
 	{
 	}

The name of the java enum, if provided.
 
 	private String myEnumJavaName;

Comma separated values of the enum.
 
 	private String myEnumValues;

Returns:
the enumJavaName
 
 	{
 		return ;
 	}

Returns:
the enumValues
 
 	public String getEnumValues()
 	{
 		return ;
 	}

Predicate telling whether the enum has a specific name.

Returns:
true if there is no name for the xml model does not define a name for the enumeration to generate.
 
 	public boolean isAnonymous()
 	{
 		return StringTools.isEmptyString(getEnumJavaName());
 	}

Parameters:
enumJavaName the enumJavaName to set
 
 	public void setEnumJavaName(String enumJavaName)
 	{
 		 = enumJavaName;
 	}

Parameters:
enumValues the enumValues to set
 
 	public void setEnumValues(String enumValues)
	{
		 = enumValues;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sporniket.javabeans.generator.PropertyType#setDescription(java.lang.String)
	 */
	public void setDescription(String description)
	{
		super.setDescription(description);
		// extract other infos
		// sanity check
		if (StringTools.isEmptyString(description))
		{
			String message = (null == description) ? "description must be not null" : "description must be not empty";
			throw new IllegalArgumentException(message);
		}
		// ok
	}

Parameters:
description
	private void setDescription__extractInformations(String description)
	{
		int _markerPos = description.indexOf();
		if (-1 == _markerPos)
		{
					"description is surely incorrect for enum, should be '(name)?:(comma separated values)', got : '" + description
"'.");
		}
		String _enumJavaName = description.substring(0, _markerPos);
		String _enumValues = description.substring(_markerPos + 1);
		setEnumJavaName(_enumJavaName);
		setEnumValues(_enumValues);
	}
New to GrepCode? Check out our FAQ X