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
<?php | |
function curlFunc($url) | |
{ | |
$cd = curl_init(); | |
curl_setopt($cd, CURLOPT_URL, $url); | |
curl_setopt($cd, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($cd, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); | |
curl_setopt($cd, CURLOPT_REFERER, 'http://www.google.com.tr/'); |
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
public class Company { | |
private String name, phone, address; | |
public Company(String name, String phone, String address) { | |
this.name = name; | |
this.phone = phone; | |
this.address = address; | |
} | |
// getter and setter methods. |
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
package pojo; | |
/** | |
* @author Yusuf | |
* @since 02.10.2017 | |
*/ | |
public class Company { | |
private String name, phone, address; |
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
Company company = new Company.Builder("Google") | |
.setAddress("San Francisco"). | |
build(); |
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
package pojo; | |
import javax.xml.bind.annotation.XmlAccessType; | |
import javax.xml.bind.annotation.XmlAccessorType; | |
import javax.xml.bind.annotation.XmlRootElement; | |
/** | |
* Kullanıcı pojo sınıfımız. | |
* @author Yusuf Çakal | |
* @since 14 Ağustos 2017 |
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
package pojo; | |
import javax.xml.bind.annotation.XmlAccessType; | |
import javax.xml.bind.annotation.XmlAccessorType; | |
import javax.xml.bind.annotation.XmlRootElement; | |
/** | |
* İş pojo sınıfımız. | |
* @author Yusuf Çakal | |
* @since 14 Ağustos 2017 |
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
package main; | |
import pojo.Job; | |
import pojo.User; | |
public class Main { | |
public static void main(String[] args) { | |
User user = new User(1,"Yusuf","yusufcakal","123456"); | |
Job job = new Job("Computer Science", "Engineer"); |
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
try { | |
File file = new File("C:\\Users\\Yusuf\\IdeaProjects\\jaxb\\data.xml"); | |
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); | |
User user = (User) unmarshaller.unmarshal(file); | |
System.out.println(user + " " + user.getJob()); | |
} catch (JAXBException e) { | |
e.printStackTrace(); | |
} |
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
package wrapper; | |
import pojo.User; | |
import javax.xml.bind.annotation.XmlElement; | |
import javax.xml.bind.annotation.XmlRootElement; | |
import java.util.List; | |
/** | |
* Kullanıcı listesi için gerekli wrapper (yardımcı, destekleyici) sınıfımız. | |
* @author Yusuf Çakal |
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
User user = new User(1,"Yusuf","yusufcakal","123456"); | |
Job job = new Job("Computer Science", "Engineer"); | |
user.setJob(job); | |
User user1 = new User(2,"Fatih","fatihsimsek","123456"); | |
Job job1 = new Job("Computer Science", "Enginerr"); | |
user1.setJob(job1); | |
List<User> userList = new ArrayList<>(); | |
userList.add(user); |
OlderNewer