You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2013/04/04 13:26:11 UTC
svn commit: r1464457 - in
/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator:
control/Controller.java source/model/PropertyAccess.java
source/model/package.html template/groovy/package.html
Author: tfischer
Date: Thu Apr 4 11:26:11 2013
New Revision: 1464457
URL: http://svn.apache.org/r1464457
Log:
TORQUE-273 fix findbugs & checkstyle errors
Added:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/package.html
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java?rev=1464457&r1=1464456&r2=1464457&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java Thu Apr 4 11:26:11 2013
@@ -316,7 +316,8 @@ public class Controller
UnitConfiguration unitConfiguration)
throws SourceException
{
- if (modelRoot == null) {
+ if (modelRoot == null)
+ {
return;
}
fillModelElement(
@@ -363,13 +364,15 @@ public class Controller
attributeName);
propertyAccess.setProperty(attributeValue);
}
- for (SourceElement child : sourceElement.getChildren()) {
+ for (SourceElement child : sourceElement.getChildren())
+ {
String propertyName = sourceElement.getName();
PropertyAccess propertyAccess = new PropertyAccess(
modelElement,
propertyName);
Object childModelElement = alreadyMapped.get(child);
- if (childModelElement != null) {
+ if (childModelElement != null)
+ {
propertyAccess.setProperty(childModelElement);
continue;
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java?rev=1464457&r1=1464456&r2=1464457&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java Thu Apr 4 11:26:11 2013
@@ -315,9 +315,10 @@ public class PropertyAccess
}
catch (IllegalArgumentException e)
{
- if (value == null) {
+ if (value == null)
+ {
throw createSetFieldException(
- value,
+ null,
" because the value is null which is not allowed",
e);
@@ -358,9 +359,10 @@ public class PropertyAccess
}
catch (IllegalArgumentException e)
{
- if (value == null) {
+ if (value == null)
+ {
throw createSetFieldException(
- value,
+ null,
" because the value is null which is not allowed",
e);
@@ -390,12 +392,18 @@ public class PropertyAccess
* A common reason for this is that no public field and no getter
* exists with the given name.
*/
- public Object getProperty() throws SourceException {
- if (field != null) {
+ public Object getProperty() throws SourceException
+ {
+ if (field != null)
+ {
return getPropertyUsingField();
- } else if (readMethod != null) {
+ }
+ else if (readMethod != null)
+ {
return getPropertyUsingGetter();
- } else {
+ }
+ else
+ {
throw new PropertyNotReadableException(target, propertyName);
}
}
@@ -461,7 +469,8 @@ public class PropertyAccess
* @return the class of the property,
* or null if the property does not exist.
*/
- public Class<?> getPropertyType() {
+ public Class<?> getPropertyType()
+ {
if (field != null)
{
return field.getType();
@@ -537,13 +546,15 @@ public class PropertyAccess
Object[] oldContent = (Object[]) getProperty();
int newIndex;
Object newContent;
- if (oldContent == null) {
+ if (oldContent == null)
+ {
newContent = Array.newInstance(
getPropertyType().getComponentType(),
1);
newIndex = 0;
}
- else {
+ else
+ {
newContent = Array.newInstance(
getPropertyType().getComponentType(),
oldContent.length + 1);
@@ -569,7 +580,8 @@ public class PropertyAccess
{
@SuppressWarnings("unchecked")
Collection<Object> content = (Collection<Object>) getProperty();
- if (content == null) {
+ if (content == null)
+ {
content = getCollectionInstance();
setPropertyStrict(content);
}
@@ -594,13 +606,16 @@ public class PropertyAccess
private Collection<Object> getCollectionInstance() throws SourceException
{
Class<?> type = getPropertyType();
- if (Collection.class == type || List.class == type) {
+ if (Collection.class == type || List.class == type)
+ {
return new ArrayList<Object>();
}
- else if (Set.class == type) {
+ else if (Set.class == type)
+ {
return new HashSet<Object>();
}
- else if (Queue.class == type) {
+ else if (Queue.class == type)
+ {
return new LinkedList<Object>();
}
else
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html?rev=1464457&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html Thu Apr 4 11:26:11 2013
@@ -0,0 +1,25 @@
+<!--
+ Copyright 2001-2006 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License")
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <title>Torque generator source model</title>
+ </head>
+ <body>
+ <p>
+ This package provides the ability to create a typed source model.
+ </p>
+ </body>
+</html>
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/package.html?rev=1464457&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/package.html (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/package.html Thu Apr 4 11:26:11 2013
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2001-2006 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License")
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <title>Torque generator velocity outlets</title>
+ </head>
+ <body>
+ <p>
+ This package contains the handling of groovy outlets in the
+ Torque generator.
+ </p>
+ </body>
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org