PARAMETERS = new Parameters();
var Parameters = function() { this.session = function(session) { this.session = session; return this;} this.type = function(type) { this.type = type; return this;} ... this.build = function() { var params = {} !this.session || params.sessionToken = this.session; !this.type || params.exportType = this.type; ... return params; } } var params = new Parameters().session(sessionToken).type("xls")...build();
method(new Parameters().setParameter1(...).setParameter3(...));
public static void main(String[] args) { Parameters parameters = new Parameters(ClassLoader.class.getClass(). getResourceAsStream("/res/raw/parameters.xml")); .... }
private class TestDeserializer implements JsonDeserializer<Test> { public Test deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject obj = json.getAsJsonObject(); int id = obj.get("id").getAsInt(); String name = obj.get("name").getAsString(); double distance = obj.get("param_distance").getAsDouble(); int sampling = obj.get("param_sampling").getAsInt(); //assuming you have suitable constructors... Test test = new Test(id, name, new Parameters(distance, sampling)); return test; } }
public static void main(String... argv) { Parameters params = new Parameters(); // Populate params from the command line parameters Earth earth = new Earth(); // Earth takes the responsibilty of processing the parameters // It will delegate the processing to the underlying objects in a chain earth.processParameters(params); }
Parameters p = new Parameters(); NumberVariable[] iV = IntegerVariable.newArray(2); Format.printf("Enter two values: "); Format.scanf("(%i, %i)", p.add(iV[0]).add(iV[1]));
Parameters params = new Parameters(); params.putString(IntParameter.ANSWER, "42"); // parse and store the value int value = p.get(IntParameter.ANSWER);
List<String> list = new ArrayList<>(); Parameters params = new Parameters(); FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration> (PropertiesConfiguration.class) .configure(params.properties() .setFileName("prop.properties")); try { Configuration config = builder.getConfiguration(); Iterator<String> keys = config.getKeys(); while(keys.hasNext()){ String key = (String) keys.next(); list.add(key); } } catch(ConfigurationException cex) { // handle exception here }
Parameters params = new Parameters(); FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>( PropertiesConfiguration.class).configure(params.fileBased() .setListDelimiterHandler(new DefaultListDelimiterHandler(',')) .setFile(new File("test.properties"))); PropertiesConfiguration config = builder.getConfiguration(); List<String> linclude = config.getList(String.class, "patternfile.include"); System.out.println(linclude.size()); for(String item: linclude){ System.out.println(item); }
Parameters params = new Parameters(); FileBasedConfigurationBuilder<XMLConfiguration> fileBuilder = new FileBasedConfigurationBuilder<>(XMLConfiguration.class) .configure(params.fileBased().setFileName("/tmp/dummy.xml"));` XMLConfiguration xmlConfiguration = fileBuilder.getConfiguration(); xmlConfiguration.read(inputStream);
@Component public class SomeConfiguration { @Bean(name="parameters") public Parameters getParameters(){ Parameters parameters = new Parameters(); // add your stuff return parameters; } @Bean(name="springRestConfiguration") public SpringRestConfiguration springRestConfiguration(){ SpringRestConfiguration springRestConfiguration = new SpringRestConfiguration(); springRestConfiguration.setParametere(getParameters()); return springRestConfiguration; } }
currentChild=new Parameters(); currentChild.setURLDecoder( urlDec ); currentChild.parent=this; currentChild.child=new Parameters(); currentChild.setURLDecoder( urlDec ); currentChild.child.parent=currentChild;
Parameters paramParser = new Parameters(); MessageBytes queryMB = MessageBytes.newInstance(); queryMB.setString(queryParamString);
Parameters parameters3 = new Parameters(); parameters3.setName("K3"); parameters3.setSyntax(SyntaxType.CONTAINER); Value paramvalue3 = obj.createValue(); JAXBElement<String> name = obj.createName("ch1"); JAXBElement<SyntaxType> synt = obj.createSyntax(SyntaxType.STRING); NodeValue ch1Value = obj.createNodeValue(); ch1Value.getContent().add("KPStringChild1"); paramvalue3.getContent().add(name); paramvalue3.getContent().add(synt); paramvalue3.getContent().add(ch1Value); parameters3.getValue().add(paramvalue3);
Parameters paramParser = new Parameters(); MessageBytes queryMB = MessageBytes.newInstance(); queryMB.setString(queryParamString);
param = new Parameters(); param.setPort("COM1"); param.setBaudRate("115200"); param = new Parameters(); param.setPort("COM1"); param.setBaudRate("115200");
private OperationPreprocessor maskPassword() { return new PasswordMaskingPreprocessor(); } private static class PasswordMaskingPreprocessor implements OperationPreprocessor { @Override public OperationRequest preprocess(OperationRequest request) { Parameters parameters = new Parameters(); parameters.putAll(request.getParameters()); parameters.set("password", "XXX"); return new OperationRequestFactory().create(request.getUri(), request.getMethod(), request.getContent(), request.getHeaders(), parameters, request.getParts()); } @Override public OperationResponse preprocess(OperationResponse response) { return response; } }