All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.teamapps.dto.TeamAppsJavaDtoGenerator.stg Maven / Gradle / Ivy

There is a newer version: 0.9.191
Show newest version
/*-
 * ========================LICENSE_START=================================
 * TeamApps
 * ---
 * Copyright (C) 2014 - 2024 TeamApps.org
 * ---
 * 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.
 * =========================LICENSE_END==================================
 */
class(c, package) ::= <<


@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type", defaultImpl = .class)

public abstract class  extends  implements }; separator=", ">, UiObject {

	

	

	

	

	

	

	

	

	

	

}>>

classReference(c, package) ::= <<

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Reference {
	

	public Reference() {
    	
    }

	

}>>

interface(i, package) ::= <<

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public interface  extends }; separator=", ">, UiObject {

	
	
	
	

	

	

	

}>>

javaFilePrelude(package) ::= <<
package ;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;

/**
 * THIS IS GENERATED CODE!
 * PLEASE DO NOT MODIFY - ALL YOUR WORK WOULD BE LOST!
 */
>>

propertyDeclaration(p) ::= <<

@JsonSerialize(using = ObjectSerializer.class)
@JsonDeserialize(using = ObjectDeserializer.class)

@UiComponentId protected   = ;
>>

getterStub(p) ::= <<
public  get();
>>

setterStub(p, c) ::= <<
public  set( );
>>

constructor(c, classNameSuffix) ::= <<

/**
 * @deprecated Only for Jackson deserialization. Use the other constructor instead.
 */
@Deprecated
public () {
	// default constructor for Jackson
}


public () {
	super(}; separator=", ">);
	
}
>>

toString(c) ::= <<
@SuppressWarnings("unchecked")
public String toString() {
	return new StringBuilder(getClass().getSimpleName()).append(": ")
			
			.toString();
}
>>

propertyToString(p) ::= <<
.append("=" +  != null ? "={" + .toString() + "}" : "")
>>

jsonSetter(p) ::= <<
 != !Objects.equals(, )) { !><\\>
if ( != null) {
	obj.put("", );
}

>>

defaultValue(p) ::=  <<
  
>>

parameter(p) ::= " "

getter(propertyDeclaration) ::= <<
@com.fasterxml.jackson.annotation.JsonGetter("")
public  get() {
	return ;
}
>>

setter(propertyDeclaration, clazz) ::= <<
@com.fasterxml.jackson.annotation.JsonSetter("")
public  set( ) {
	
	return this;
}
>>

propertyAssignment(p) ::= "this. = ;"

inlineEnum(propertyDeclaration) ::= <<
public enum  {
	}; separator=", ">;

	@com.fasterxml.jackson.annotation.JsonValue
	public int jsonValue() {
		return ordinal();
	}
}
>>

enumClass(e, package) ::= <<

public enum  {
	;

	
	private final String jsonValue;

	(String jsonValue) {
		this.jsonValue = jsonValue;
	}

	@com.fasterxml.jackson.annotation.JsonValue
	public String jsonValue() {
		return jsonValue;
	}
	
    @com.fasterxml.jackson.annotation.JsonValue
    public int jsonValue() {
        return ordinal();
    }
	
}>>


enumConstant(ec, hasStringValues) ::= <<
	()
>>

eventClass(ed) ::= <<
public static class Event implements UiEvent {

	

	

	

	

	

    
    public String getComponentId() {
        return null;
    }
    

}
>>

queryClass(qd) ::= <<
public static class Query implements UiQuery {

	

	

	

	

	

}
>>

typeGetter(e, kind) ::= <<
public UiType getUiType() {
	return UiType._;
}
>>

commandClass(cmd) ::= <<
public static class Command implements UiCommand\<\> {

	

	

	

	

	
	public String getComponentId() {
		return null;
	}
	

}
>>

uiObjectTypeEnum(package, allClasses) ::= <<


public enum UiObjectType {

	(.class)}; separator=",\n">;

	private final Class\ apiClass;

	UiObjectType(Class\ apiClass) {
		this.apiClass = apiClass;
	}

	public Class\ getApiClass() {
		return apiClass;
	}

}
>>

uiObjectTypeGetter(enumTypeString) ::= <<
@com.fasterxml.jackson.annotation.JsonIgnore
public UiObjectType getUiObjectType() {
	return UiObjectType.;
}
>>


uiEventBaseClass(package, allEventDeclarations) ::= <<


@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public interface UiEvent {

	String getComponentId();

	UiEventType getUiEventType();

}
>>

uiQueryBaseClass(package, allQueryDeclarations) ::= <<


@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public interface UiQuery {

	String getComponentId();

	UiQueryType getUiQueryType();

}
>>

uiObjectBaseClass(package, allClasses) ::= <<


@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public interface UiObject {

	UiObjectType getUiObjectType();

}
>>

uiEventEnum(package, allEventDeclarations) ::= <<


public enum UiEventType {

	_(.Event.class)}; separator=",\n">;

	private final Class\ apiClass;

	UiEventType(Class\ apiClass) {
		this.apiClass = apiClass;
	}

	public Class\ getApiClass() {
		return apiClass;
	}

}
>>

uiQueryEnum(package, allQueryDeclarations) ::= <<


public enum UiQueryType {

	_(.Query.class)}; separator=",\n">;

	private final Class\ apiClass;

	UiQueryType(Class\ apiClass) {
		this.apiClass = apiClass;
	}

	public Class\ getApiClass() {
		return apiClass;
	}

}
>>

uiCommandBaseClass(package, allCommandDeclarations) ::= <<


@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "_type")
@JsonTypeIdResolver(TeamAppsJacksonTypeIdResolver.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public interface UiCommand\ {

	String getComponentId();

}
>>

jacksonTypeIdMaps(package, allJsonSerializableClasses) ::= <<


import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class UiObjectJacksonTypeIdMaps {
	public static final Map\ ID_BY_CLASS = Collections.unmodifiableMap(new HashMap\() {{
		.class, "");}; separator=";\n">
	}});
	public static final Map\ CLASS_BY_ID = Collections.unmodifiableMap(new HashMap\() {{
		", .class);}; separator=";\n">
	}});
}
>>

cmd(package) ::= <<

import com.fasterxml.jackson.annotation.JsonRawValue;

public class CMD {

	protected long id;

	@JsonRawValue
	protected String uiCommand;

	/**
	 * @deprecated Only for Jackson deserialization. Use the other constructor instead.
	 */
	@Deprecated
	public CMD() {
		// default constructor for Jackson
	}

	public CMD(long id, String uiCommand) {
		this.id = id;
		this.uiCommand = uiCommand;
	}

	@Override
	public String toString() {
		return "CMD{uiCommand='" + uiCommand.substring(0, 20) + '\'' + ", id=" + id + '}';
	}

	public long getId() {
		return id;
	}

	public String getUiCommand() {
		return uiCommand;
	}

}
>>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy