Professor, se eu refatorar esse código dessa maneira, terei que repetir o
throw para a Exceção caso a validação presente no if não seja atendida.


2014-02-01 rodrigovilar <notifications@github.com>:

> In kernel/src/main/java/com/nanuvem/lom/kernel/AttributeServiceImpl.java:
>
> > +	private void validateUpdateType(Attribute attribute) {
> > +		Attribute attributeFound = this.findAttributeById(attribute.getId());
> > +
> > +		if (!attributeFound.getType().equals(attribute.getType())) {
> > +			throw new MetadataException(
> > +					"Can not change the type of an attribute");
> > +		}
> > +	}
> > +
> > +	private void validateUpdateSequence(Attribute attribute) {
> > +		Class clazz = this.classService.readClass(attribute.getClazz()
> > +				.getFullName());
> > +		int currentNumberOfAttributes = clazz.getAttributes()
> > +				.get(clazz.getAttributes().size() - 1).getSequence();
> > +
> > +		if (attribute.getSequence() != null) {
>
> if (attribute.getSequence() == null) {
> throw new MetadataException("Invalid value for Attribute sequence: "
> + attribute.getSequence());
> }
>
> boolean minValueForSequence = attribute.getSequence() <
> MINIMUM_VALUE_FOR_THE_ATTRIBUTE_SEQUENCE;
> boolean maxValueForSequence = currentNumberOfAttributes < attribute
> .getSequence();
> if (!(minValueForSequence || maxValueForSequence)) {
> return;
> }
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/rodrigovilar/lom/pull/33/files#r9365304>
> .
>



-- 
*AttFernando Mateus de Oliveira*