Skip to content

Commit

Permalink
Automated code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Apr 22, 2018
1 parent e47a0ce commit 763bcb1
Show file tree
Hide file tree
Showing 44 changed files with 456 additions and 466 deletions.
Expand Up @@ -31,8 +31,8 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList
import net.fortuna.ical4j.model.Property
import net.fortuna.ical4j.model.PropertyList

/**
* $Id$
Expand All @@ -52,8 +52,8 @@ abstract class AbstractComponentFactory extends AbstractFactory {
return newInstance(properties)
}

protected abstract Object newInstance(PropertyList properties);
protected abstract Object newInstance(PropertyList properties)

void setChild(FactoryBuilderSupport build, Object parent, Object child) {
if (child instanceof Property) {
parent.properties.add(child)
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
Expand All @@ -46,7 +46,7 @@ class AvailableFactory extends AbstractComponentFactory{
available = (Available) value
}
else {
available = super.newInstance(builder, name, value, attributes);
available = super.newInstance(builder, name, value, attributes)
}
return available
}
Expand Down
Expand Up @@ -31,22 +31,22 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class DaylightFactory extends AbstractComponentFactory{
class DaylightFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Daylight daylight
if (FactoryBuilderSupport.checkValueIsType(value, name, Daylight.class)) {
daylight = (Daylight) value
}
else {
daylight = super.newInstance(builder, name, value, attributes);
daylight = super.newInstance(builder, name, value, attributes)
}
return daylight
}
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
Expand All @@ -46,7 +46,7 @@ class StandardFactory extends AbstractComponentFactory{
standard = (Standard) value
}
else {
standard = super.newInstance(builder, name, value, attributes);
standard = super.newInstance(builder, name, value, attributes)
}
return standard
}
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
Expand All @@ -46,7 +46,7 @@ class VAlarmFactory extends AbstractComponentFactory{
alarm = (VAlarm) value
}
else {
alarm = super.newInstance(builder, name, value, attributes);
alarm = super.newInstance(builder, name, value, attributes)
}
return alarm
}
Expand Down
Expand Up @@ -31,22 +31,22 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class VAvailabilityFactory extends AbstractComponentFactory{
class VAvailabilityFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
VAvailability availability
if (FactoryBuilderSupport.checkValueIsType(value, name, VAvailability.class)) {
availability = (VAvailability) value
}
else {
availability = super.newInstance(builder, name, value, attributes);
availability = super.newInstance(builder, name, value, attributes)
}
return availability
}
Expand Down
Expand Up @@ -31,7 +31,6 @@
*/
package net.fortuna.ical4j.model.component

import groovy.util.FactoryBuilderSupport
import net.fortuna.ical4j.model.PropertyList

/**
Expand All @@ -47,7 +46,7 @@ class VEventFactory extends AbstractComponentFactory{
event = (VEvent) value
}
else {
event = super.newInstance(builder, name, value, attributes);
event = super.newInstance(builder, name, value, attributes)
}
return event
}
Expand Down
Expand Up @@ -31,22 +31,22 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class VFreeBusyFactory extends AbstractComponentFactory{
class VFreeBusyFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
VFreeBusy freeBusy
if (FactoryBuilderSupport.checkValueIsType(value, name, VFreeBusy.class)) {
freeBusy = (VFreeBusy) value
}
else {
freeBusy = super.newInstance(builder, name, value, attributes);
freeBusy = super.newInstance(builder, name, value, attributes)
}
return freeBusy
}
Expand Down
Expand Up @@ -31,22 +31,22 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class VJournalFactory extends AbstractComponentFactory{
class VJournalFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
VJournal journal
if (FactoryBuilderSupport.checkValueIsType(value, name, VJournal.class)) {
journal = (VJournal) value
}
else {
journal = super.newInstance(builder, name, value, attributes);
journal = super.newInstance(builder, name, value, attributes)
}
return journal
}
Expand Down
Expand Up @@ -31,8 +31,7 @@
*/
package net.fortuna.ical4j.model.component

import groovy.util.FactoryBuilderSupport;
import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
Expand All @@ -47,7 +46,7 @@ class VTimeZoneFactory extends AbstractComponentFactory{
timeZone = (VTimeZone) value
}
else {
timeZone = super.newInstance(builder, name, value, attributes);
timeZone = super.newInstance(builder, name, value, attributes)
}
return timeZone
}
Expand Down
Expand Up @@ -31,32 +31,31 @@
*/
package net.fortuna.ical4j.model.component

import groovy.util.FactoryBuilderSupport;
import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class VToDoFactory extends AbstractComponentFactory{
class VToDoFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
VToDo toDo
if (FactoryBuilderSupport.checkValueIsType(value, name, VToDo.class)) {
toDo = (VToDo) value
}
else {
toDo = super.newInstance(builder, name, value, attributes);
toDo = super.newInstance(builder, name, value, attributes)
}
return toDo
}

protected Object newInstance(PropertyList properties) {
return new VToDo(properties)
}
public void setChild(FactoryBuilderSupport build, Object parent, Object child) {

void setChild(FactoryBuilderSupport build, Object parent, Object child) {
if (child instanceof VAlarm) {
parent.alarms.add child
}
Expand Down
Expand Up @@ -31,22 +31,22 @@
*/
package net.fortuna.ical4j.model.component

import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.PropertyList

/**
* @author fortuna
*
*/
public class VVenueFactory extends AbstractComponentFactory{
class VVenueFactory extends AbstractComponentFactory{


public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
VVenue venue
if (FactoryBuilderSupport.checkValueIsType(value, name, VVenue.class)) {
venue = (VVenue) value
}
else {
venue = super.newInstance(builder, name, value, attributes);
venue = super.newInstance(builder, name, value, attributes)
}
return venue
}
Expand Down
Expand Up @@ -55,7 +55,7 @@ class XComponentFactory extends AbstractFactory {
if (properties == null) {
properties = new PropertyList()
}
component = newInstance(componentName, properties);
component = newInstance(componentName, properties)
}
return component
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ abstract class AbstractParameterFactory extends AbstractFactory {
* {@inheritDoc}
*/
boolean isLeaf() {
return true;
return true
}
}

@@ -1,38 +1,38 @@
/**
* Copyright (c) 2012, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Copyright (c) 2012, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.fortuna.ical4j.model.property

import net.fortuna.ical4j.model.Parameter
import net.fortuna.ical4j.model.ParameterList
import net.fortuna.ical4j.model.Parameter
import net.fortuna.ical4j.model.ParameterList
/**
* $Id$
*
Expand All @@ -41,9 +41,9 @@ import net.fortuna.ical4j.model.ParameterList
* @author fortuna
*
*/
public abstract class AbstractPropertyFactory extends AbstractFactory {
abstract class AbstractPropertyFactory extends AbstractFactory {

public Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException {
ParameterList parameters = attributes.remove('parameters')
if (parameters == null) {
parameters = new ParameterList()
Expand All @@ -57,9 +57,9 @@ public abstract class AbstractPropertyFactory extends AbstractFactory {
}
}

protected abstract Object newInstance(ParameterList parameters, String value);
public void setChild(FactoryBuilderSupport build, Object parent, Object child) {
protected abstract Object newInstance(ParameterList parameters, String value)

void setChild(FactoryBuilderSupport build, Object parent, Object child) {
if (child instanceof Parameter) {
parent.parameters.add(child)
}
Expand Down

0 comments on commit 763bcb1

Please sign in to comment.