Skip to content

Commit

Permalink
Refactor getter name to avoid JSON serialization, Fix #101
Browse files Browse the repository at this point in the history
  • Loading branch information
minborg committed Jan 15, 2016
1 parent c6ca6c1 commit a14f38f
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 66 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/speedment/code/StandardTranslatorKey.java
@@ -1,3 +1,19 @@
/**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
*
* 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.
*/
package com.speedment.code; package com.speedment.code;


import com.speedment.config.db.Project; import com.speedment.config.db.Project;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/speedment/code/Translator.java
Expand Up @@ -110,7 +110,7 @@ default Column column() {
* *
* @return the enabled columns * @return the enabled columns
* @see Column * @see Column
* @see Enableable#isEnabled() * @see HasEnabled#isEnabled()
*/ */
default Stream<? extends Column> columns() { default Stream<? extends Column> columns() {
return table().columns().filter(HasEnabled::test); return table().columns().filter(HasEnabled::test);
Expand All @@ -122,7 +122,7 @@ default Stream<? extends Column> columns() {
* *
* @return the enabled indexes * @return the enabled indexes
* @see Index * @see Index
* @see Enableable#isEnabled() * @see HasEnabled#isEnabled()
*/ */
default Stream<? extends Index> indexes() { default Stream<? extends Index> indexes() {
return table().indexes().filter(HasEnabled::test); return table().indexes().filter(HasEnabled::test);
Expand All @@ -134,7 +134,7 @@ default Stream<? extends Index> indexes() {
* *
* @return the enabled foreign keys * @return the enabled foreign keys
* @see ForeignKey * @see ForeignKey
* @see Enableable#isEnabled() * @see HasEnabled#isEnabled()
*/ */
default Stream<? extends ForeignKey> foreignKeys() { default Stream<? extends ForeignKey> foreignKeys() {
return table().foreignKeys().filter(HasEnabled::test); return table().foreignKeys().filter(HasEnabled::test);
Expand All @@ -146,7 +146,7 @@ default Stream<? extends ForeignKey> foreignKeys() {
* *
* @return the enabled primary key columns * @return the enabled primary key columns
* @see PrimaryKeyColumn * @see PrimaryKeyColumn
* @see Enableable#isEnabled() * @see HasEnabled#isEnabled()
*/ */
default Stream<? extends PrimaryKeyColumn> primaryKeyColumns() { default Stream<? extends PrimaryKeyColumn> primaryKeyColumns() {
return table().primaryKeyColumns().filter(HasEnabled::test); return table().primaryKeyColumns().filter(HasEnabled::test);
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/speedment/code/TranslatorConstructor.java
@@ -1,3 +1,19 @@
/**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
*
* 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.
*/
package com.speedment.code; package com.speedment.code;


import com.speedment.Speedment; import com.speedment.Speedment;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/speedment/code/TranslatorKey.java
@@ -1,3 +1,19 @@
/**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
*
* 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.
*/
package com.speedment.code; package com.speedment.code;


import com.speedment.config.db.trait.HasMainInterface; import com.speedment.config.db.trait.HasMainInterface;
Expand Down
Expand Up @@ -109,7 +109,7 @@ default <T extends HasMainInterface> void remove(Class<T> clazz, TranslatorKey<T
* registered key. * registered key.
* *
* @param <T> Document type * @param <T> Document type
* @param document * @param document to use when making translators
* @return a Stream of newly created {@code Translator Translators} for the * @return a Stream of newly created {@code Translator Translators} for the
* given Document * given Document
*/ */
Expand All @@ -121,8 +121,8 @@ default <T extends HasMainInterface> void remove(Class<T> clazz, TranslatorKey<T
* included in the Stream. * included in the Stream.
* *
* @param <T> Document type * @param <T> Document type
* @param document * @param document to use when making translators
* @param hasKey * @param hasKey key
* @return a Stream of newly created {@code Translator Translators} for the * @return a Stream of newly created {@code Translator Translators} for the
* given Document * given Document
*/ */
Expand All @@ -137,8 +137,8 @@ default <T extends HasMainInterface> void remove(Class<T> clazz, TranslatorKey<T
* included in the Stream. * included in the Stream.
* *
* @param <T> Document type * @param <T> Document type
* @param document * @param document to use when making translators
* @param key * @param key key
* @return a Stream of newly created {@code Translator Translators} for the * @return a Stream of newly created {@code Translator Translators} for the
* given Document * given Document
*/ */
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/com/speedment/event/PreviewEvent.java
@@ -1,17 +1,18 @@
/* /**
* Copyright 2016 Speedment, Inc.. *
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); You may not
* you may not use this file except in compliance with the License. * use this file except in compliance with the License. You may obtain a copy of
* You may obtain a copy of the License at * the License at:
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* See the License for the specific language governing permissions and * License for the specific language governing permissions and limitations under
* limitations under the License. * the License.
*/ */
package com.speedment.event; package com.speedment.event;


Expand Down
Expand Up @@ -38,7 +38,7 @@ public AbstractBaseEntity(Speedment speedment) {
this.speedment = requireNonNull(speedment); this.speedment = requireNonNull(speedment);
} }


protected Speedment getSpeedment_() { protected Speedment speedment() {
return speedment; return speedment;
} }


Expand Down Expand Up @@ -82,19 +82,19 @@ public ENTITY remove(Consumer<MetaResult<ENTITY>> consumer) throws SpeedmentExce
return manager_().remove(selfAsEntity(), consumer); return manager_().remove(selfAsEntity(), consumer);
} }


protected abstract Class<ENTITY> getEntityClass_(); protected abstract Class<ENTITY> entityClass();


@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private ENTITY selfAsEntity() { private ENTITY selfAsEntity() {
return (ENTITY) this; return (ENTITY) this;
} }


protected Manager<ENTITY> manager_() { protected Manager<ENTITY> manager_() {
return managerOf_(getEntityClass_()); return managerOf_(entityClass());
} }


protected <T> Manager<T> managerOf_(Class<T> entityClass) { protected <T> Manager<T> managerOf_(Class<T> entityClass) {
return getSpeedment_().managerOf(requireNonNull(entityClass)); return speedment().managerOf(requireNonNull(entityClass));
} }


} }
@@ -1,3 +1,19 @@
/**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
*
* 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.
*/
package com.speedment.internal.core.code; package com.speedment.internal.core.code;


import com.speedment.code.TranslatorKey; import com.speedment.code.TranslatorKey;
Expand Down
Expand Up @@ -202,7 +202,7 @@ protected Class make(File file) {
.add(toString(file)) .add(toString(file))
.add(equalsMethod()) .add(equalsMethod())
.add(hashCodeMethod()) .add(hashCodeMethod())
.add(Method.of("getEntityClass_", Type.of(java.lang.Class.class).add(Generic.of().add(ENTITY.getType()))).public_().add(OVERRIDE) .add(Method.of("entityClass", Type.of(java.lang.Class.class).add(Generic.of().add(ENTITY.getType()))).public_().add(OVERRIDE)
.add("return " + ENTITY.getName() + ".class;") .add("return " + ENTITY.getName() + ".class;")
); );


Expand All @@ -212,7 +212,7 @@ protected Class make(File file) {


private Method copy() { private Method copy() {
return Method.of("copy", ENTITY.getType()).public_().add(OVERRIDE) return Method.of("copy", ENTITY.getType()).public_().add(OVERRIDE)
.add("return new " + ENTITY.getImplName() + "(getSpeedment_(), this);"); .add("return new " + ENTITY.getImplName() + "(speedment(), this);");


} }


Expand Down
@@ -1,4 +1,5 @@
/* /**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved. * Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); You may not * Licensed under the Apache License, Version 2.0 (the "License"); You may not
Expand Down
@@ -1,17 +1,18 @@
/* /**
* Copyright 2016 Speedment, Inc.. *
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); You may not
* you may not use this file except in compliance with the License. * use this file except in compliance with the License. You may obtain a copy of
* You may obtain a copy of the License at * the License at:
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* See the License for the specific language governing permissions and * License for the specific language governing permissions and limitations under
* limitations under the License. * the License.
*/ */
package com.speedment.internal.ui.config.preview; package com.speedment.internal.ui.config.preview;


Expand Down
@@ -1,17 +1,18 @@
/* /**
* Copyright 2016 Speedment, Inc.. *
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); You may not
* you may not use this file except in compliance with the License. * use this file except in compliance with the License. You may obtain a copy of
* You may obtain a copy of the License at * the License at:
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* See the License for the specific language governing permissions and * License for the specific language governing permissions and limitations under
* limitations under the License. * the License.
*/ */
package com.speedment.internal.ui.property; package com.speedment.internal.ui.property;


Expand Down
@@ -1,17 +1,18 @@
/* /**
* Copyright 2016 Speedment, Inc.. *
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); You may not
* you may not use this file except in compliance with the License. * use this file except in compliance with the License. You may obtain a copy of
* You may obtain a copy of the License at * the License at:
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* See the License for the specific language governing permissions and * License for the specific language governing permissions and limitations under
* limitations under the License. * the License.
*/ */
package com.speedment.internal.ui.property; package com.speedment.internal.ui.property;


Expand Down
21 changes: 11 additions & 10 deletions src/main/java/com/speedment/internal/util/document/TraitUtil.java
@@ -1,17 +1,18 @@
/* /**
* Copyright 2016 Speedment, Inc.. *
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); You may not
* you may not use this file except in compliance with the License. * use this file except in compliance with the License. You may obtain a copy of
* You may obtain a copy of the License at * the License at:
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* See the License for the specific language governing permissions and * License for the specific language governing permissions and limitations under
* limitations under the License. * the License.
*/ */
package com.speedment.internal.util.document; package com.speedment.internal.util.document;


Expand Down

0 comments on commit a14f38f

Please sign in to comment.