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

com.getperka.flatpack.fast.java.stg Maven / Gradle / Ivy

There is a newer version: 2.21.0
Show newest version
/*
 * #%L
 * FlatPack Automatic Source Tool
 * %%
 * Copyright (C) 2012 Perka Inc.
 * %%
 * 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.
 * #L%
 */
entity(entity, packageName) ::= <<
// Generated File - DO NOT EDIT
package ;


@("")
 extends  {
  /**
   * Returns the type name used to identify instances of  in a payload.
   */
  public static String typeName() {
    return "";
  }

  
  
  
}
>>

/**
 * Extracted to ease formatting.
 */
entityDeclaration() ::= <%

  abstract class Base

  public class 
 
%>

enum(enum, packageName) ::= <<
// Generated File - DO NOT EDIT
package ;


public enum  {
  }; separator=",\n">;
}
>>

field(property) ::= <%
private  ;
%>

/**
 * Emit a JavaDoc string, reflowed to fit the current context.
 */
docString(docString) ::= <<
/**
 * 
 */
>>

/*
 * Generate a single getter.  If the property has documentation or special semantics, the
 * JavaDoc comment or relevant annotation(s) will be emitted. Note that the property roles
 * applied to the getter are reversed.
 */
getter(property) ::= <<

@
@
@
@("")

public  get() {
  return this.;
}
>>

/**
 * Generate a single property setter.  Again, note the reversal of the property roles.
 */
setter(property) ::= <<

public void set( value) {
  
   flag = dirtyFlag("");
  flag.set();
  this. = .dirtyTracking(value, flag);
  
  this. = value;
  
}
>>

/**
 * Create property security annotation. The kind parameter should be a string
 * either "getter" or "setter".  The property.({template}) allows for dynamic lookup
 * based on the value of kind.
 */
propertyRoles(kind) ::= <%
PermitAll}))>
  @
RoleNames}))>
  @({RoleNames}):{x|""}; separator=", ">})

%>

/**
 * Generate an API accessor stub.
 */
api(api, packageName, namePrefix, apiIsPublic) ::= <<
// Generated File - DO NOT EDIT
package ;

public class Api extends  {
  public Api( flatpack) {
    super(flatpack);
  }

  
}
>>

/**
 * Select the kind of endpoint, either one that's documented to return a FlatPackEntity
 * or just return a HttpURLConnection for anything else.
 */
endpoint(end) ::= <%

  

  
 
%>

/**
 * Generates interfaces and methods for API methods that don't use flatpack.
 */
endpointConnectionResponse(end) ::= <<
public interface  extends \<, \> {
  
}

private class Impl
    extends \<\>
    implements  {
  public Impl(Object... args) {
    super(Api.this, "", "", false, args);
  }
  
}


public  () {
  Impl toReturn =
      new Impl(}; separator=", ">);
  toReturn.setEntity(entity);
  return toReturn;
}
>>

/**
 * Generates interfaces and methods for API methods that are fully-flatpacked.
 */
endpointFlatPack(end) ::= <<
public interface  extends \<, \> {
  
}

private class Impl
    extends \<, \>
    implements  {
  public Impl(Object... args) {
    super(Api.this, , "", "", , args);
  }
  
}


public  () {
  Impl toReturn =
      new Impl(}; separator=", ">);
  toReturn.setEntity(entity);
  return toReturn;
}
>>

endpointArgList() ::= <%

   entity,  }; separator=", ">

   entity

   }; separator=", ">

%>

/**
 * Make a call to FlatPackTypes.createType() for a synthetic Type reference.
 */
endpointCreateType(type) ::= <%
.createType(.class}; separator=", ">)
%>

/**
 * The names of the path parameter arguments.
 */
endpointPathParameters() ::= <%
}; separator=", ">
%>

/**
 * Create a stub method declaration for a request interface.
 */
endpointQueryParameterStub(param) ::= <<

 with( );
>>

endpointQueryParameterImpl(param) ::= <<
public  with( ) {
  return queryParameter("", );
}
>>

typeSource(allEntities, packageName, namePrefix) ::= <<
// Generated File - DO NOT EDIT
package ;
public class TypeSource implements  {
  private static final \\> classes = .unmodifiableSet(
    new \\>(.\\>asList(
      .class}; wrap, separator=", ">
    )));
  private static final  instance = new TypeSource();
  
  public static  get() {
    return instance;
  }

  public \\> getTypes() {
    return classes;
  }
  
  private TypeSource(){}
}
>>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy