forked from redhat-developer/quarkus-ls
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes redhat-developer#629 Signed-off-by: azerr <azerr@redhat.com>
- Loading branch information
1 parent
f7ef2e8
commit a3d3f54
Showing
33 changed files
with
1,656 additions
and
196 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ects/maven/qute-quickstart/src/main/java/org/acme/qute/ItemWithRegisterForReflection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.acme.qute; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection(fields = false) | ||
public class ItemWithRegisterForReflection { | ||
|
||
public final String name; | ||
|
||
public final BigDecimal price; | ||
|
||
public ItemWithRegisterForReflection(BigDecimal price, String name) { | ||
this.price = price; | ||
this.name = name; | ||
} | ||
|
||
public Item[] getDerivedItems() { | ||
return null; | ||
} | ||
|
||
public static BigDecimal staticMethod(Item item) { | ||
return item.price.multiply(new BigDecimal("0.9")); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...test/projects/maven/qute-quickstart/src/main/java/org/acme/qute/ItemWithTemplateData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.acme.qute; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import io.quarkus.qute.TemplateData; | ||
|
||
@TemplateData(target = BigDecimal.class) | ||
@TemplateData(ignoreSuperclasses = true) | ||
public class ItemWithTemplateData { | ||
|
||
public final String name; | ||
|
||
public final BigDecimal price; | ||
|
||
public ItemWithTemplateData(BigDecimal price, String name) { | ||
this.price = price; | ||
this.name = name; | ||
} | ||
|
||
public Item[] getDerivedItems() { | ||
return null; | ||
} | ||
|
||
public static BigDecimal staticMethod(Item item) { | ||
return item.price.multiply(new BigDecimal("0.9")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...edhat.qute.jdt/src/main/java/com/redhat/qute/commons/RegisterForReflectionAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.qute.commons; | ||
|
||
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
|
||
/** | ||
* '@io.quarkus.runtime.annotations.RegisterForReflection' annotation | ||
* | ||
* This annotation that can be used to force a class to be registered for | ||
* reflection in native image mode | ||
*/ | ||
public class RegisterForReflectionAnnotation { | ||
|
||
/** | ||
* If the methods should be registered | ||
*/ | ||
private Boolean methods; | ||
|
||
/** | ||
* If the fields should be registered | ||
*/ | ||
private Boolean fields; | ||
|
||
public boolean isMethods() { | ||
if (methods == null) { | ||
return true; | ||
} | ||
return methods.booleanValue(); | ||
} | ||
|
||
public void setMethods(Boolean methods) { | ||
this.methods = methods; | ||
} | ||
|
||
public boolean isFields() { | ||
if (fields == null) { | ||
return true; | ||
} | ||
return fields.booleanValue(); | ||
} | ||
|
||
public void setFields(Boolean fields) { | ||
this.fields = fields; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
ToStringBuilder b = new ToStringBuilder(this); | ||
b.add("fields", this.isFields()); | ||
b.add("methods", this.isMethods()); | ||
return b.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/commons/TemplateDataAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.qute.commons; | ||
|
||
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
|
||
/** | ||
* '@io.quarkus.qute.TemplateData' annotation. | ||
* | ||
* @author Angelo ZERR | ||
* | ||
*/ | ||
public class TemplateDataAnnotation { | ||
|
||
/** | ||
* If set to true do not automatically analyze superclasses. | ||
*/ | ||
private Boolean ignoreSuperclasses; | ||
|
||
public boolean isIgnoreSuperclasses() { | ||
return ignoreSuperclasses != null && ignoreSuperclasses.booleanValue(); | ||
} | ||
|
||
public void setIgnoreSuperclasses(Boolean ignoreSuperclasses) { | ||
this.ignoreSuperclasses = ignoreSuperclasses; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
ToStringBuilder b = new ToStringBuilder(this); | ||
b.add("ignoreSuperclasses", this.isIgnoreSuperclasses()); | ||
return b.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.